mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Make transaction forwarding less promiscuous
This commit is contained in:
@@ -148,20 +148,20 @@ public:
|
||||
//
|
||||
typedef std::function<void (Transaction::pointer, TER)> stCallback; // must complete immediately
|
||||
void submitTransaction (Job&, SerializedTransaction::pointer, stCallback callback = stCallback ());
|
||||
Transaction::pointer submitTransactionSync (Transaction::ref tpTrans, bool bAdmin, bool bFailHard, bool bSubmit);
|
||||
Transaction::pointer submitTransactionSync (Transaction::ref tpTrans, bool bAdmin, bool bLocal, bool bFailHard, bool bSubmit);
|
||||
|
||||
void runTransactionQueue ();
|
||||
Transaction::pointer processTransactionCb (Transaction::pointer, bool bAdmin, bool bFailHard, stCallback);
|
||||
Transaction::pointer processTransaction (Transaction::pointer transaction, bool bAdmin, bool bFailHard)
|
||||
Transaction::pointer processTransactionCb (Transaction::pointer, bool bAdmin, bool bLocal, bool bFailHard, stCallback);
|
||||
Transaction::pointer processTransaction (Transaction::pointer transaction, bool bAdmin, bool bLocal, bool bFailHard)
|
||||
{
|
||||
return processTransactionCb (transaction, bAdmin, bFailHard, stCallback ());
|
||||
return processTransactionCb (transaction, bAdmin, bLocal, bFailHard, stCallback ());
|
||||
}
|
||||
|
||||
// VFALCO Workaround for MSVC std::function which doesn't swallow return types.
|
||||
//
|
||||
void processTransactionCbVoid (Transaction::pointer p, bool bAdmin, bool bFailHard, stCallback cb)
|
||||
void processTransactionCbVoid (Transaction::pointer p, bool bAdmin, bool bLocal, bool bFailHard, stCallback cb)
|
||||
{
|
||||
processTransactionCb (p, bAdmin, bFailHard, cb);
|
||||
processTransactionCb (p, bAdmin, bLocal, bFailHard, cb);
|
||||
}
|
||||
|
||||
Transaction::pointer findTransactionByID (uint256 const& transactionID);
|
||||
@@ -751,12 +751,12 @@ void NetworkOPsImp::submitTransaction (Job&, SerializedTransaction::pointer iTra
|
||||
|
||||
getApp().getJobQueue().addJob (jtTRANSACTION, "submitTxn",
|
||||
std::bind (&NetworkOPsImp::processTransactionCbVoid, this,
|
||||
boost::make_shared<Transaction> (trans, false), false, false, callback));
|
||||
boost::make_shared<Transaction> (trans, false), false, false, false, callback));
|
||||
}
|
||||
|
||||
// Sterilize transaction through serialization.
|
||||
// This is fully synchronous and deprecated
|
||||
Transaction::pointer NetworkOPsImp::submitTransactionSync (Transaction::ref tpTrans, bool bAdmin, bool bFailHard, bool bSubmit)
|
||||
Transaction::pointer NetworkOPsImp::submitTransactionSync (Transaction::ref tpTrans, bool bAdmin, bool bLocal, bool bFailHard, bool bSubmit)
|
||||
{
|
||||
Serializer s;
|
||||
tpTrans->getSTransaction ()->add (s);
|
||||
@@ -771,7 +771,7 @@ Transaction::pointer NetworkOPsImp::submitTransactionSync (Transaction::ref tpTr
|
||||
else if (tpTransNew->getSTransaction ()->isEquivalent (*tpTrans->getSTransaction ()))
|
||||
{
|
||||
if (bSubmit)
|
||||
(void) NetworkOPsImp::processTransaction (tpTransNew, bAdmin, bFailHard);
|
||||
(void) NetworkOPsImp::processTransaction (tpTransNew, bAdmin, bLocal, bFailHard);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -875,7 +875,7 @@ void NetworkOPsImp::runTransactionQueue ()
|
||||
}
|
||||
|
||||
Transaction::pointer NetworkOPsImp::processTransactionCb (
|
||||
Transaction::pointer trans, bool bAdmin, bool bFailHard, stCallback callback)
|
||||
Transaction::pointer trans, bool bAdmin, bool bLocal, bool bFailHard, stCallback callback)
|
||||
{
|
||||
LoadEvent::autoptr ev = getApp().getJobQueue ().getLoadEventAP (jtTXN_PROC, "ProcessTXN");
|
||||
|
||||
@@ -968,7 +968,7 @@ Transaction::pointer NetworkOPsImp::processTransactionCb (
|
||||
trans->setStatus (INVALID);
|
||||
}
|
||||
|
||||
if (didApply || ((mMode != omFULL) && !bFailHard))
|
||||
if (didApply || ((mMode != omFULL) && !bFailHard && bLocal))
|
||||
{
|
||||
std::set<Peer::ShortId> peers;
|
||||
|
||||
|
||||
@@ -141,12 +141,12 @@ public:
|
||||
virtual void submitTransaction (Job&, SerializedTransaction::pointer,
|
||||
stCallback callback = stCallback ()) = 0;
|
||||
virtual Transaction::pointer submitTransactionSync (Transaction::ref tpTrans,
|
||||
bool bAdmin, bool bFailHard, bool bSubmit) = 0;
|
||||
bool bAdmin, bool bLocal, bool bFailHard, bool bSubmit) = 0;
|
||||
virtual void runTransactionQueue () = 0;
|
||||
virtual Transaction::pointer processTransactionCb (Transaction::pointer,
|
||||
bool bAdmin, bool bFailHard, stCallback) = 0;
|
||||
bool bAdmin, bool bLocal, bool bFailHard, stCallback) = 0;
|
||||
virtual Transaction::pointer processTransaction (Transaction::pointer transaction,
|
||||
bool bAdmin, bool bFailHard) = 0;
|
||||
bool bAdmin, bool bLocal, bool bFailHard) = 0;
|
||||
virtual Transaction::pointer findTransactionByID (uint256 const& transactionID) = 0;
|
||||
virtual int findTransactionsByDestination (std::list<Transaction::pointer>&,
|
||||
const RippleAddress& destinationAccount, uint32 startLedgerSeq,
|
||||
|
||||
@@ -470,7 +470,7 @@ Json::Value RPCHandler::transactionSign (Json::Value params,
|
||||
{
|
||||
// FIXME: For performance, should use asynch interface
|
||||
tpTrans = mNetOps->submitTransactionSync (tpTrans,
|
||||
mRole == Config::ADMIN, bFailHard, bSubmit);
|
||||
mRole == Config::ADMIN, true, bFailHard, bSubmit);
|
||||
|
||||
if (!tpTrans)
|
||||
{
|
||||
@@ -2046,7 +2046,7 @@ Json::Value RPCHandler::doSubmit (Json::Value params, Resource::Charge& loadType
|
||||
|
||||
try
|
||||
{
|
||||
(void) mNetOps->processTransaction (tpTrans, mRole == Config::ADMIN,
|
||||
(void) mNetOps->processTransaction (tpTrans, mRole == Config::ADMIN, true,
|
||||
params.isMember ("fail_hard") && params["fail_hard"].asBool ());
|
||||
}
|
||||
catch (std::exception& e)
|
||||
|
||||
@@ -2623,7 +2623,7 @@ private:
|
||||
else
|
||||
getApp().getHashRouter ().setFlag (stx->getTransactionID (), SF_SIGGOOD);
|
||||
|
||||
getApp().getOPs ().processTransaction (tx, isSetBit (flags, SF_TRUSTED), false);
|
||||
getApp().getOPs ().processTransaction (tx, isSetBit (flags, SF_TRUSTED), false, false);
|
||||
|
||||
#ifndef TRUST_NETWORK
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user