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:
Vinnie Falco
2015-07-26 14:25:59 -07:00
committed by Edward Hennis
parent d49f9ea109
commit 3f0eacf5e7
25 changed files with 1043 additions and 15 deletions

View File

@@ -45,4 +45,6 @@ feature (const char* name)
return feature(name, std::strlen(name));
}
uint256 const featureSusPay = feature("SusPay");
} // ripple

View File

@@ -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

View File

@@ -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)

View File

@@ -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");

View File

@@ -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)