This commit is contained in:
Denis Angell
2023-11-25 00:01:14 +01:00
parent 5c144b6ce6
commit 1b3aa7c051
5 changed files with 2126 additions and 1667 deletions

View File

@@ -47,7 +47,7 @@ using namespace ripple;
static const std::map<uint16_t, uint8_t> TSHAllowances = {
{ttPAYMENT, tshROLLBACK},
{ttESCROW_CREATE, tshROLLBACK},
{ttESCROW_FINISH, tshROLLBACK},
{ttESCROW_FINISH, tshCOLLECT},
{ttACCOUNT_SET, tshNONE},
{ttESCROW_CANCEL, tshCOLLECT},
{ttREGULAR_KEY_SET, tshROLLBACK},

View File

@@ -300,14 +300,15 @@ getTransactionalStakeHolders(STTx const& tx, ReadView const& rv)
case ttESCROW_CANCEL:
case ttESCROW_FINISH: {
if (!tx.isFieldPresent(sfOwner) ||
!tx.isFieldPresent(sfOfferSequence) ||
if (!tx.isFieldPresent(sfOwner))
return {};
if (!tx.isFieldPresent(sfOfferSequence) &&
!tx.isFieldPresent(sfEscrowID))
return {};
std::optional<uint256> escrowID = tx.getFieldH256(sfEscrowID);
std::optional<std::uint32_t> offerSeq =
tx.getFieldU32(sfOfferSequence);
std::optional<uint256> escrowID = tx[~sfEscrowID];
std::optional<std::uint32_t> offerSeq = tx[~sfOfferSequence];
Keylet k = escrowID
? Keylet(ltESCROW, *escrowID)

File diff suppressed because it is too large Load Diff

View File

@@ -17,6 +17,7 @@
*/
//==============================================================================
#include <ripple/basics/StringUtilities.h>
#include <ripple/protocol/TxFlags.h>
#include <ripple/protocol/jss.h>
#include <test/jtx/network.h>
@@ -48,6 +49,43 @@ makeNetworkConfig(
});
}
std::unique_ptr<Config>
makeNetworkVLConfig(
uint32_t networkID,
std::string fee,
std::string a_res,
std::string o_res,
std::vector<std::string> keys)
{
using namespace jtx;
return envconfig([&](std::unique_ptr<Config> cfg) {
cfg->NETWORK_ID = networkID;
Section config;
config.append(
{"reference_fee = " + fee,
"account_reserve = " + a_res,
"owner_reserve = " + o_res});
auto setup = setup_FeeVote(config);
cfg->FEES = setup;
for (auto const& strPk : keys)
{
auto pkHex = strUnHex(strPk);
if (!pkHex)
Throw<std::runtime_error>(
"Import VL Key '" + strPk + "' was not valid hex.");
auto const pkType = publicKeyType(makeSlice(*pkHex));
if (!pkType)
Throw<std::runtime_error>(
"Import VL Key '" + strPk + "' was not a valid key type.");
cfg->IMPORT_VL_KEYS.emplace(strPk, makeSlice(*pkHex));
}
return cfg;
});
}
} // namespace network
} // namespace jtx

View File

@@ -37,6 +37,14 @@ makeNetworkConfig(
std::string a_res,
std::string o_res);
std::unique_ptr<Config>
makeNetworkVLConfig(
uint32_t networkID,
std::string fee,
std::string a_res,
std::string o_res,
std::vector<std::string> keys);
} // namespace network
} // namespace jtx