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