mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Add SuspendedPayment feature (RIPD-992):
The code is enabled in jtx::Env, and enabled in production ledgers only if the SuspendedPayment amendment is voted into a ledger.
This commit is contained in:
committed by
Edward Hennis
parent
d49f9ea109
commit
3f0eacf5e7
@@ -34,6 +34,8 @@ uint256
|
||||
feature (const char* name);
|
||||
/** @} */
|
||||
|
||||
extern uint256 const featureSusPay;
|
||||
|
||||
} // ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <ripple/protocol/Keylet.h>
|
||||
#include <ripple/protocol/LedgerFormats.h>
|
||||
#include <ripple/protocol/Protocol.h>
|
||||
#include <ripple/protocol/PublicKey.h>
|
||||
#include <ripple/protocol/RippleAddress.h>
|
||||
#include <ripple/protocol/Serializer.h>
|
||||
#include <ripple/protocol/UintTypes.h>
|
||||
@@ -234,6 +235,10 @@ Keylet page (uint256 const& key)
|
||||
return { ltDIR_NODE, key };
|
||||
}
|
||||
|
||||
/** A SuspendedPayment */
|
||||
Keylet
|
||||
susPay (AccountID const& source, std::uint32_t seq);
|
||||
|
||||
} // keylet
|
||||
|
||||
}
|
||||
|
||||
@@ -64,15 +64,12 @@ enum LedgerEntryType
|
||||
*/
|
||||
ltDIR_NODE = 'd',
|
||||
|
||||
/** Describes a trust line.
|
||||
*/
|
||||
ltRIPPLE_STATE = 'r',
|
||||
|
||||
ltTICKET = 'T',
|
||||
|
||||
ltSIGNER_LIST = 'S',
|
||||
|
||||
/* Deprecated. */
|
||||
ltOFFER = 'o',
|
||||
|
||||
ltLEDGER_HASHES = 'h',
|
||||
@@ -81,6 +78,8 @@ enum LedgerEntryType
|
||||
|
||||
ltFEE_SETTINGS = 's',
|
||||
|
||||
ltSUSPAY = 'u',
|
||||
|
||||
// No longer used or supported. Left here to prevent accidental
|
||||
// reassignment of the ledger type.
|
||||
ltNICKNAME = 'n',
|
||||
@@ -103,6 +102,7 @@ enum LedgerNameSpace
|
||||
spaceBookDir = 'B', // Directory of order books.
|
||||
spaceContract = 'c',
|
||||
spaceSkipList = 's',
|
||||
spaceSusPay = 'u',
|
||||
spaceAmendment = 'f',
|
||||
spaceFee = 'e',
|
||||
spaceTicket = 'T',
|
||||
|
||||
@@ -344,7 +344,7 @@ extern SField const sfMetadata;
|
||||
|
||||
// 8-bit integers
|
||||
extern SF_U8 const sfCloseResolution;
|
||||
extern SF_U8 const sfTemplateEntryType;
|
||||
extern SF_U8 const sfMethod;
|
||||
extern SF_U8 const sfTransactionResult;
|
||||
|
||||
// 16-bit integers
|
||||
@@ -388,6 +388,8 @@ extern SF_U32 const sfReserveIncrement;
|
||||
extern SF_U32 const sfSetFlag;
|
||||
extern SF_U32 const sfClearFlag;
|
||||
extern SF_U32 const sfSignerQuorum;
|
||||
extern SF_U32 const sfCancelAfter;
|
||||
extern SF_U32 const sfFinishAfter;
|
||||
|
||||
// 64-bit integers
|
||||
extern SF_U64 const sfIndexNext;
|
||||
@@ -461,7 +463,7 @@ extern SF_Blob const sfMemoFormat;
|
||||
|
||||
// variable length (uncommon)
|
||||
extern SF_Blob const sfMultiSignature;
|
||||
extern SF_Blob const sfInnerSig;
|
||||
extern SF_Blob const sfProof;
|
||||
|
||||
// account
|
||||
extern SF_Account const sfAccount;
|
||||
|
||||
@@ -35,10 +35,10 @@ enum TxType
|
||||
ttINVALID = -1,
|
||||
|
||||
ttPAYMENT = 0,
|
||||
ttCLAIM = 1, // open
|
||||
ttWALLET_ADD = 2, // unused
|
||||
ttSUSPAY_CREATE = 1,
|
||||
ttSUSPAY_FINISH = 2,
|
||||
ttACCOUNT_SET = 3,
|
||||
ttPASSWORD_FUND = 4, // open
|
||||
ttSUSPAY_CANCEL = 4,
|
||||
ttREGULAR_KEY_SET = 5,
|
||||
ttNICKNAME_SET = 6, // open
|
||||
ttOFFER_CREATE = 7,
|
||||
|
||||
@@ -45,4 +45,6 @@ feature (const char* name)
|
||||
return feature(name, std::strlen(name));
|
||||
}
|
||||
|
||||
uint256 const featureSusPay = feature("SusPay");
|
||||
|
||||
} // ripple
|
||||
|
||||
@@ -308,6 +308,17 @@ Keylet page(Keylet const& root,
|
||||
return page(root.key, index);
|
||||
}
|
||||
|
||||
Keylet
|
||||
susPay (AccountID const& source, std::uint32_t seq)
|
||||
{
|
||||
sha512_half_hasher h;
|
||||
using beast::hash_append;
|
||||
hash_append(h, spaceSusPay);
|
||||
hash_append(h, source);
|
||||
hash_append(h, seq);
|
||||
return { ltSUSPAY, static_cast<uint256>(h) };
|
||||
}
|
||||
|
||||
} // keylet
|
||||
|
||||
} // ripple
|
||||
|
||||
@@ -81,6 +81,19 @@ LedgerFormats::LedgerFormats ()
|
||||
<< SOElement (sfHighQualityOut, SOE_OPTIONAL)
|
||||
;
|
||||
|
||||
add ("SusPay", ltSUSPAY) <<
|
||||
SOElement (sfAccount, SOE_REQUIRED) <<
|
||||
SOElement (sfDestination, SOE_REQUIRED) <<
|
||||
SOElement (sfAmount, SOE_REQUIRED) <<
|
||||
SOElement (sfDigest, SOE_OPTIONAL) <<
|
||||
SOElement (sfCancelAfter, SOE_OPTIONAL) <<
|
||||
SOElement (sfFinishAfter, SOE_OPTIONAL) <<
|
||||
SOElement (sfSourceTag, SOE_OPTIONAL) <<
|
||||
SOElement (sfDestinationTag, SOE_OPTIONAL) <<
|
||||
SOElement (sfOwnerNode, SOE_REQUIRED) <<
|
||||
SOElement (sfPreviousTxnID, SOE_REQUIRED) <<
|
||||
SOElement (sfPreviousTxnLgrSeq, SOE_REQUIRED);
|
||||
|
||||
add ("LedgerHashes", ltLEDGER_HASHES)
|
||||
<< SOElement (sfFirstLedgerSequence, SOE_OPTIONAL) // Remove if we do a ledger restart
|
||||
<< SOElement (sfLastLedgerSequence, SOE_OPTIONAL)
|
||||
|
||||
@@ -77,7 +77,7 @@ SField const sfIndex = make::one(&sfIndex, STI_HASH256, 258, "in
|
||||
|
||||
// 8-bit integers
|
||||
SF_U8 const sfCloseResolution = make::one<SF_U8::type>(&sfCloseResolution, STI_UINT8, 1, "CloseResolution");
|
||||
SF_U8 const sfTemplateEntryType = make::one<SF_U8::type>(&sfTemplateEntryType, STI_UINT8, 2, "TemplateEntryType");
|
||||
SF_U8 const sfMethod = make::one<SF_U8::type>(&sfMethod, STI_UINT8, 2, "Method");
|
||||
SF_U8 const sfTransactionResult = make::one<SF_U8::type>(&sfTransactionResult, STI_UINT8, 3, "TransactionResult");
|
||||
|
||||
// 16-bit integers
|
||||
@@ -121,6 +121,8 @@ SF_U32 const sfReserveIncrement = make::one<SF_U32::type>(&sfReserveIncrement
|
||||
SF_U32 const sfSetFlag = make::one<SF_U32::type>(&sfSetFlag, STI_UINT32, 33, "SetFlag");
|
||||
SF_U32 const sfClearFlag = make::one<SF_U32::type>(&sfClearFlag, STI_UINT32, 34, "ClearFlag");
|
||||
SF_U32 const sfSignerQuorum = make::one<SF_U32::type>(&sfSignerQuorum, STI_UINT32, 35, "SignerQuorum");
|
||||
SF_U32 const sfCancelAfter = make::one<SF_U32::type>(&sfCancelAfter, STI_UINT32, 36, "CancelAfter");
|
||||
SF_U32 const sfFinishAfter = make::one<SF_U32::type>(&sfFinishAfter, STI_UINT32, 37, "FinishAfter");
|
||||
|
||||
// 64-bit integers
|
||||
SF_U64 const sfIndexNext = make::one<SF_U64::type>(&sfIndexNext, STI_UINT64, 1, "IndexNext");
|
||||
@@ -194,7 +196,7 @@ SF_Blob const sfMemoFormat = make::one<SF_Blob::type>(&sfMemoFormat, STI
|
||||
|
||||
// variable length (uncommon)
|
||||
SF_Blob const sfMultiSignature = make::one<SF_Blob::type>(&sfMultiSignature, STI_VL, 16, "MultiSignature");
|
||||
SF_Blob const sfInnerSig = make::one<SF_Blob::type>(&sfInnerSig, STI_VL, 17, "InnerSig");
|
||||
SF_Blob const sfProof = make::one<SF_Blob::type>(&sfProof, STI_VL, 17, "Proof");
|
||||
|
||||
// account
|
||||
SF_Account const sfAccount = make::one<SF_Account::type>(&sfAccount, STI_ACCOUNT, 1, "Account");
|
||||
|
||||
@@ -67,6 +67,25 @@ TxFormats::TxFormats ()
|
||||
<< SOElement (sfDeliverMin, SOE_OPTIONAL)
|
||||
;
|
||||
|
||||
add ("SuspendedPaymentCreate", ttSUSPAY_CREATE) <<
|
||||
SOElement (sfDestination, SOE_REQUIRED) <<
|
||||
SOElement (sfAmount, SOE_REQUIRED) <<
|
||||
SOElement (sfDigest, SOE_OPTIONAL) <<
|
||||
SOElement (sfCancelAfter, SOE_OPTIONAL) <<
|
||||
SOElement (sfFinishAfter, SOE_OPTIONAL) <<
|
||||
SOElement (sfDestinationTag, SOE_OPTIONAL);
|
||||
|
||||
add ("SuspendedPaymentFinish", ttSUSPAY_FINISH) <<
|
||||
SOElement (sfOwner, SOE_REQUIRED) <<
|
||||
SOElement (sfOfferSequence, SOE_REQUIRED) <<
|
||||
SOElement (sfMethod, SOE_OPTIONAL) <<
|
||||
SOElement (sfDigest, SOE_OPTIONAL) <<
|
||||
SOElement (sfProof, SOE_OPTIONAL);
|
||||
|
||||
add ("SuspendedPaymentCancel", ttSUSPAY_CANCEL) <<
|
||||
SOElement (sfOwner, SOE_REQUIRED) <<
|
||||
SOElement (sfOfferSequence, SOE_REQUIRED);
|
||||
|
||||
add ("EnableAmendment", ttAMENDMENT)
|
||||
<< SOElement (sfLedgerSequence, SOE_OPTIONAL)
|
||||
<< SOElement (sfAmendment, SOE_REQUIRED)
|
||||
|
||||
Reference in New Issue
Block a user