mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-28 06:25:49 +00:00
.
This commit is contained in:
@@ -150,7 +150,6 @@
|
||||
<ClCompile Include="src\cpp\ripple\RippleLines.cpp" />
|
||||
<ClCompile Include="src\cpp\ripple\RippleState.cpp" />
|
||||
<ClCompile Include="src\cpp\ripple\rpc.cpp" />
|
||||
<ClCompile Include="src\cpp\ripple\RPCCommands.cpp" />
|
||||
<ClCompile Include="src\cpp\ripple\RPCDoor.cpp" />
|
||||
<ClCompile Include="src\cpp\ripple\RPCHandler.cpp" />
|
||||
<ClCompile Include="src\cpp\ripple\RPCServer.cpp" />
|
||||
|
||||
@@ -198,9 +198,6 @@
|
||||
<ClCompile Include="src\cpp\ripple\rpc.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\RPCCommands.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\RPCDoor.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
class AccountSetTransactor : public Transactor
|
||||
{
|
||||
public:
|
||||
AccountSetTransactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine::pointer engine) : Transactor(txn,params,engine) {}
|
||||
AccountSetTransactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine* engine) : Transactor(txn,params,engine) {}
|
||||
|
||||
TER doApply();
|
||||
};
|
||||
@@ -3,7 +3,7 @@
|
||||
class OfferCancelTransactor : public Transactor
|
||||
{
|
||||
public:
|
||||
OfferCancelTransactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine::pointer engine) : Transactor(txn,params,engine) {}
|
||||
OfferCancelTransactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine* engine) : Transactor(txn,params,engine) {}
|
||||
|
||||
TER doApply();
|
||||
};
|
||||
@@ -14,7 +14,7 @@ class OfferCreateTransactor : public Transactor
|
||||
STAmount& saTakerGot);
|
||||
|
||||
public:
|
||||
OfferCreateTransactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine::pointer engine) : Transactor(txn,params,engine) {}
|
||||
OfferCreateTransactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine* engine) : Transactor(txn,params,engine) {}
|
||||
|
||||
TER doApply();
|
||||
};
|
||||
|
||||
@@ -5,7 +5,7 @@ class PaymentTransactor : public Transactor
|
||||
{
|
||||
void calculateFee();
|
||||
public:
|
||||
PaymentTransactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine::pointer engine) : Transactor(txn,params,engine) {}
|
||||
PaymentTransactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine* engine) : Transactor(txn,params,engine) {}
|
||||
|
||||
TER doApply();
|
||||
};
|
||||
@@ -4,7 +4,7 @@ class RegularKeySetTransactor : public Transactor
|
||||
{
|
||||
void calculateFee();
|
||||
public:
|
||||
RegularKeySetTransactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine::pointer engine) : Transactor(txn,params,engine) {}
|
||||
RegularKeySetTransactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine* engine) : Transactor(txn,params,engine) {}
|
||||
TER checkFee();
|
||||
TER checkSig();
|
||||
TER doApply();
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include <boost/format.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/smart_ptr/shared_ptr.hpp>
|
||||
|
||||
#include "TransactionEngine.h"
|
||||
#include "Transactor.h"
|
||||
@@ -89,7 +90,7 @@ TER TransactionEngine::applyTransaction(const SerializedTransaction& txn, Transa
|
||||
}
|
||||
#endif
|
||||
|
||||
Transactor::pointer transactor=Transactor::makeTransactor(txn,params,shared_from_this());
|
||||
Transactor::pointer transactor=Transactor::makeTransactor(txn,params,this);
|
||||
if(transactor)
|
||||
{
|
||||
uint256 txID = txn.getTransactionID();
|
||||
|
||||
@@ -36,7 +36,7 @@ enum TransactionEngineParams
|
||||
|
||||
// One instance per ledger.
|
||||
// Only one transaction applied at a time.
|
||||
class TransactionEngine : public boost::enable_shared_from_this<TransactionEngine>, private IS_INSTANCE(TransactionEngine)
|
||||
class TransactionEngine : private IS_INSTANCE(TransactionEngine)
|
||||
{
|
||||
private:
|
||||
LedgerEntrySet mNodes;
|
||||
|
||||
@@ -9,15 +9,9 @@
|
||||
#include "OfferCreateTransactor.h"
|
||||
#include "TrustSetTransactor.h"
|
||||
|
||||
|
||||
SETUP_LOG();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Transactor::pointer Transactor::makeTransactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine::pointer engine)
|
||||
Transactor::pointer Transactor::makeTransactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine* engine)
|
||||
{
|
||||
switch(txn.getTxnType())
|
||||
{
|
||||
@@ -41,7 +35,7 @@ Transactor::pointer Transactor::makeTransactor(const SerializedTransaction& txn,
|
||||
}
|
||||
|
||||
|
||||
Transactor::Transactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine::pointer engine) : mTxn(txn), mParams(params), mEngine(engine)
|
||||
Transactor::Transactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine* engine) : mTxn(txn), mParams(params), mEngine(engine)
|
||||
{
|
||||
mHasAuthKey=false;
|
||||
}
|
||||
@@ -190,10 +184,6 @@ TER Transactor::apply()
|
||||
|
||||
calculateFee();
|
||||
|
||||
terResult=payFee();
|
||||
if(terResult != tesSUCCESS) return(terResult);
|
||||
|
||||
|
||||
boost::recursive_mutex::scoped_lock sl(mEngine->getLedger()->mLock);
|
||||
|
||||
mTxnAccount = mEngine->entryCache(ltACCOUNT_ROOT, Ledger::getAccountRootIndex(mTxnAccountID));
|
||||
@@ -201,10 +191,6 @@ TER Transactor::apply()
|
||||
// Find source account
|
||||
// If are only forwarding, due to resource limitations, we might verifying only some transactions, this would be probabilistic.
|
||||
|
||||
STAmount saSrcBalance;
|
||||
|
||||
|
||||
|
||||
if (!mTxnAccount)
|
||||
{
|
||||
cLog(lsTRACE) << boost::str(boost::format("applyTransaction: Delay transaction: source account does not exist: %s") %
|
||||
@@ -218,6 +204,9 @@ TER Transactor::apply()
|
||||
mHasAuthKey = mTxnAccount->isFieldPresent(sfAuthorizedKey);
|
||||
}
|
||||
|
||||
terResult=payFee();
|
||||
if(terResult != tesSUCCESS) return(terResult);
|
||||
|
||||
terResult=checkSig();
|
||||
if(terResult != tesSUCCESS) return(terResult);
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ class Transactor
|
||||
{
|
||||
protected:
|
||||
const SerializedTransaction& mTxn;
|
||||
TransactionEngine::pointer mEngine;
|
||||
TransactionEngine* mEngine;
|
||||
TransactionEngineParams mParams;
|
||||
|
||||
uint160 mTxnAccountID;
|
||||
@@ -28,12 +28,12 @@ protected:
|
||||
virtual TER checkSig();
|
||||
virtual TER doApply()=0;
|
||||
|
||||
Transactor(const SerializedTransaction& txn, TransactionEngineParams params, TransactionEngine::pointer engine);
|
||||
Transactor(const SerializedTransaction& txn, TransactionEngineParams params, TransactionEngine* engine);
|
||||
|
||||
public:
|
||||
typedef boost::shared_ptr<Transactor> pointer;
|
||||
|
||||
static Transactor::pointer makeTransactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine::pointer engine);
|
||||
static Transactor::pointer makeTransactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine* engine);
|
||||
|
||||
TER apply();
|
||||
};
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
class TrustSetTransactor : public Transactor
|
||||
{
|
||||
public:
|
||||
TrustSetTransactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine::pointer engine) : Transactor(txn,params,engine) {}
|
||||
TrustSetTransactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine* engine) : Transactor(txn,params,engine) {}
|
||||
|
||||
TER doApply();
|
||||
};
|
||||
@@ -4,7 +4,7 @@
|
||||
class WalletAddTransactor : public Transactor
|
||||
{
|
||||
public:
|
||||
WalletAddTransactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine::pointer engine) : Transactor(txn,params,engine) {}
|
||||
WalletAddTransactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine* engine) : Transactor(txn,params,engine) {}
|
||||
|
||||
TER doApply();
|
||||
};
|
||||
@@ -21,7 +21,7 @@ var EventEmitter = require('events').EventEmitter;
|
||||
var Amount = require('./amount.js').Amount;
|
||||
var UInt160 = require('./amount.js').UInt160;
|
||||
|
||||
// Request events emmitted:
|
||||
// Request events emitted:
|
||||
// 'success' : Request successful.
|
||||
// 'error' : Request failed.
|
||||
// 'remoteError'
|
||||
@@ -166,11 +166,11 @@ Request.prototype.accounts = function (accounts) {
|
||||
// Remote - access to a remote Ripple server via websocket.
|
||||
//
|
||||
// Events:
|
||||
// 'connectted'
|
||||
// 'connected'
|
||||
// 'disconnected'
|
||||
// 'state':
|
||||
// - 'online' : connectted and subscribed
|
||||
// - 'offline' : not subscribed or not connectted.
|
||||
// - 'online' : connected and subscribed
|
||||
// - 'offline' : not subscribed or not connected.
|
||||
// 'ledger_closed': A good indicate of ready to serve.
|
||||
// 'subscribed' : This indicates stand-alone is available.
|
||||
//
|
||||
@@ -268,7 +268,7 @@ Remote.fees = {
|
||||
'offer' : Amount.from_json("10"),
|
||||
};
|
||||
|
||||
// Set the emited state: 'online' or 'offline'
|
||||
// Set the emitted state: 'online' or 'offline'
|
||||
Remote.prototype._set_state = function (state) {
|
||||
if (this.trace) console.log("remote: set_state: %s", state);
|
||||
|
||||
|
||||
@@ -14,12 +14,13 @@ exports.servers = {
|
||||
// A local test server.
|
||||
"alpha" : {
|
||||
'trusted' : true,
|
||||
'no_server' : true,
|
||||
// "peer_ip" : "0.0.0.0",
|
||||
// "peer_port" : 51235,
|
||||
'rpc_ip' : "0.0.0.0",
|
||||
'rpc_port' : 5005,
|
||||
'websocket_ip' : "127.0.0.1",
|
||||
'websocket_port' : 6005,
|
||||
'websocket_port' : 5006,
|
||||
// 'validation_seed' : "shhDFVsmS2GSu5vUyZSPXYfj1r79h",
|
||||
// 'validators' : "n9L8LZZCwsdXzKUN9zoVxs4YznYXZ9hEhsQZY7aVpxtFaSceiyDZ beta"
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ buster.testCase("Sending", {
|
||||
'setUp' : testutils.build_setup(),
|
||||
'tearDown' : testutils.build_teardown(),
|
||||
|
||||
"send XRP to non-existant account without create." :
|
||||
"=>send XRP to non-existent account without create." :
|
||||
function (done) {
|
||||
var self = this;
|
||||
var ledgers = 20;
|
||||
@@ -77,7 +77,7 @@ buster.testCase("Sending", {
|
||||
},
|
||||
|
||||
// Also test transaction becomes lost after terNO_DST.
|
||||
"credit_limit to non-existant account = terNO_DST" :
|
||||
"credit_limit to non-existent account = terNO_DST" :
|
||||
function (done) {
|
||||
this.remote.transaction()
|
||||
.ripple_line_set("root", "100/USD/alice")
|
||||
@@ -102,7 +102,7 @@ buster.testCase("Sending", {
|
||||
testutils.create_accounts(self.remote, "root", "10000", ["alice", "bob", "mtgox"], callback);
|
||||
},
|
||||
function (callback) {
|
||||
self.what = "Check a non-existant credit limit.";
|
||||
self.what = "Check a non-existent credit limit.";
|
||||
|
||||
self.remote.request_ripple_balance("alice", "mtgox", "USD", 'CURRENT')
|
||||
.on('ripple_state', function (m) {
|
||||
|
||||
Reference in New Issue
Block a user