Add Destination to Check threading

This commit is contained in:
Scott Schurr
2019-08-19 11:34:01 -07:00
committed by Nik Bougalis
parent 56eac5c9a1
commit a9a4e2c8fb
4 changed files with 29 additions and 28 deletions

View File

@@ -20,6 +20,7 @@
#include <ripple/ledger/detail/ApplyStateTable.h> #include <ripple/ledger/detail/ApplyStateTable.h>
#include <ripple/basics/Log.h> #include <ripple/basics/Log.h>
#include <ripple/json/to_string.h> #include <ripple/json/to_string.h>
#include <ripple/protocol/Feature.h>
#include <ripple/protocol/st.h> #include <ripple/protocol/st.h>
#include <cassert> #include <cassert>
@@ -614,25 +615,14 @@ ApplyStateTable::threadOwners (ReadView const& base,
SLE const> const& sle, Mods& mods, SLE const> const& sle, Mods& mods,
beast::Journal j) beast::Journal j)
{ {
switch(sle->getType()) LedgerEntryType const ledgerType {sle->getType()};
switch(ledgerType)
{ {
case ltACCOUNT_ROOT: case ltACCOUNT_ROOT:
{ {
// Nothing to do // Nothing to do
break; break;
} }
case ltESCROW:
{
threadTx (base, meta, (*sle)[sfAccount], mods, j);
threadTx (base, meta, (*sle)[sfDestination], mods, j);
break;
}
case ltPAYCHAN:
{
threadTx (base, meta, (*sle)[sfAccount], mods, j);
threadTx (base, meta, (*sle)[sfDestination], mods, j);
break;
}
case ltRIPPLE_STATE: case ltRIPPLE_STATE:
{ {
threadTx (base, meta, (*sle)[sfLowLimit].getIssuer(), mods, j); threadTx (base, meta, (*sle)[sfLowLimit].getIssuer(), mods, j);
@@ -642,9 +632,16 @@ ApplyStateTable::threadOwners (ReadView const& base,
default: default:
{ {
// If sfAccount is present, thread to that account // If sfAccount is present, thread to that account
if ((*sle)[~sfAccount]) if (auto const optSleAcct {(*sle)[~sfAccount]})
threadTx (base, meta, (*sle)[sfAccount], mods, j); threadTx (base, meta, *optSleAcct, mods, j);
// Don't thread a check's sfDestination unless the amendment is enabled
if (ledgerType == ltCHECK && !base.rules().enabled(fixCheckThreading))
break; break;
// If sfDestination is present, thread to that account
if (auto const optSleDest {(*sle)[~sfDestination]})
threadTx (base, meta, *optSleDest, mods, j);
} }
} }
} }

View File

@@ -84,7 +84,8 @@ class FeatureCollections
"fix1578", "fix1578",
"MultiSignReserve", "MultiSignReserve",
"fixTakerDryOfferRemoval", "fixTakerDryOfferRemoval",
"fixMasterKeyAsRegularKey" "fixMasterKeyAsRegularKey",
"fixCheckThreading",
}; };
std::vector<uint256> features; std::vector<uint256> features;
@@ -371,6 +372,7 @@ extern uint256 const fix1578;
extern uint256 const featureMultiSignReserve; extern uint256 const featureMultiSignReserve;
extern uint256 const fixTakerDryOfferRemoval; extern uint256 const fixTakerDryOfferRemoval;
extern uint256 const fixMasterKeyAsRegularKey; extern uint256 const fixMasterKeyAsRegularKey;
extern uint256 const fixCheckThreading;
} // ripple } // ripple

View File

@@ -118,6 +118,7 @@ detail::supportedAmendments ()
"MultiSignReserve", "MultiSignReserve",
"fixTakerDryOfferRemoval", "fixTakerDryOfferRemoval",
"fixMasterKeyAsRegularKey", "fixMasterKeyAsRegularKey",
"fixCheckThreading",
}; };
return supported; return supported;
} }
@@ -175,5 +176,6 @@ uint256 const fix1578 = *getRegisteredFeature("fix1578");
uint256 const featureMultiSignReserve = *getRegisteredFeature("MultiSignReserve"); uint256 const featureMultiSignReserve = *getRegisteredFeature("MultiSignReserve");
uint256 const fixTakerDryOfferRemoval = *getRegisteredFeature("fixTakerDryOfferRemoval"); uint256 const fixTakerDryOfferRemoval = *getRegisteredFeature("fixTakerDryOfferRemoval");
uint256 const fixMasterKeyAsRegularKey = *getRegisteredFeature("fixMasterKeyAsRegularKey"); uint256 const fixMasterKeyAsRegularKey = *getRegisteredFeature("fixMasterKeyAsRegularKey");
uint256 const fixCheckThreading = *getRegisteredFeature("fixCheckThreading");
} // ripple } // ripple

View File

@@ -415,10 +415,10 @@ class AccountTx_test : public beast::unit_test::suite
{ {
// txType, created, deleted, modified // txType, created, deleted, modified
{ 0, jss::DepositPreauth, {jss::DepositPreauth}, {}, {jss::AccountRoot, jss::DirectoryNode}}, { 0, jss::DepositPreauth, {jss::DepositPreauth}, {}, {jss::AccountRoot, jss::DirectoryNode}},
{ 1, jss::CheckCancel, {}, {jss::Check}, {jss::AccountRoot, jss::DirectoryNode, jss::DirectoryNode}}, { 1, jss::CheckCancel, {}, {jss::Check}, {jss::AccountRoot, jss::AccountRoot, jss::DirectoryNode, jss::DirectoryNode}},
{ 2, jss::CheckCash, {}, {jss::Check}, {jss::AccountRoot, jss::AccountRoot, jss::DirectoryNode, jss::DirectoryNode}}, { 2, jss::CheckCash, {}, {jss::Check}, {jss::AccountRoot, jss::AccountRoot, jss::DirectoryNode, jss::DirectoryNode}},
{ 3, jss::CheckCreate, {jss::Check}, {}, {jss::AccountRoot, jss::DirectoryNode, jss::DirectoryNode}}, { 3, jss::CheckCreate, {jss::Check}, {}, {jss::AccountRoot, jss::AccountRoot, jss::DirectoryNode, jss::DirectoryNode}},
{ 4, jss::CheckCreate, {jss::Check}, {}, {jss::AccountRoot, jss::DirectoryNode, jss::DirectoryNode}}, { 4, jss::CheckCreate, {jss::Check}, {}, {jss::AccountRoot, jss::AccountRoot, jss::DirectoryNode, jss::DirectoryNode}},
{ 5, jss::PaymentChannelClaim, {}, {jss::PayChannel}, {jss::AccountRoot, jss::AccountRoot, jss::DirectoryNode}}, { 5, jss::PaymentChannelClaim, {}, {jss::PayChannel}, {jss::AccountRoot, jss::AccountRoot, jss::DirectoryNode}},
{ 6, jss::PaymentChannelFund, {}, {}, {jss::AccountRoot, jss::PayChannel }}, { 6, jss::PaymentChannelFund, {}, {}, {jss::AccountRoot, jss::PayChannel }},
{ 7, jss::PaymentChannelCreate, {jss::PayChannel}, {}, {jss::AccountRoot, jss::AccountRoot, jss::DirectoryNode}}, { 7, jss::PaymentChannelCreate, {jss::PayChannel}, {}, {jss::AccountRoot, jss::AccountRoot, jss::DirectoryNode}},