mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
sign_for RPC command (RIPD-182):
The sign_for RPC command returns a field suitable for signing a multi-signed transaction. Actual multi-signed transactions are in the next commit.
This commit is contained in:
committed by
Vinnie Falco
parent
64ebd64d2b
commit
cf1638e6de
@@ -98,6 +98,7 @@ public:
|
||||
add (rpcPORT_MALFORMED, "portMalformed", "Port is malformed.");
|
||||
add (rpcPUBLIC_MALFORMED, "publicMalformed", "Public key is malformed.");
|
||||
add (rpcQUALITY_MALFORMED, "qualityMalformed", "Quality malformed.");
|
||||
add (rpcSIGN_FOR_MALFORMED, "signForMalformed", "Signing for account is malformed.");
|
||||
add (rpcSLOW_DOWN, "slowDown", "You are placing too much load on the server.");
|
||||
add (rpcSRC_ACT_MALFORMED, "srcActMalformed", "Source account is malformed.");
|
||||
add (rpcSRC_ACT_MISSING, "srcActMissing", "Source account not provided.");
|
||||
|
||||
@@ -31,6 +31,7 @@ HashPrefix const HashPrefix::leafNode ('M', 'L', 'N');
|
||||
HashPrefix const HashPrefix::innerNode ('M', 'I', 'N');
|
||||
HashPrefix const HashPrefix::ledgerMaster ('L', 'W', 'R');
|
||||
HashPrefix const HashPrefix::txSign ('S', 'T', 'X');
|
||||
HashPrefix const HashPrefix::txMultiSign ('S', 'M', 'T');
|
||||
HashPrefix const HashPrefix::validation ('V', 'A', 'L');
|
||||
HashPrefix const HashPrefix::proposal ('P', 'R', 'P');
|
||||
|
||||
|
||||
@@ -175,7 +175,7 @@ SField const sfMinimumOffer = make::one(&sfMinimumOffer, STI_AMOUNT, 16, "
|
||||
SField const sfRippleEscrow = make::one(&sfRippleEscrow, STI_AMOUNT, 17, "RippleEscrow");
|
||||
SField const sfDeliveredAmount = make::one(&sfDeliveredAmount, STI_AMOUNT, 18, "DeliveredAmount");
|
||||
|
||||
// variable length
|
||||
// variable length (common)
|
||||
TypedField<STBlob> const sfPublicKey = make::one<STBlob>(&sfPublicKey, STI_VL, 1, "PublicKey");
|
||||
TypedField<STBlob> const sfSigningPubKey = make::one<STBlob>(&sfSigningPubKey, STI_VL, 3, "SigningPubKey");
|
||||
TypedField<STBlob> const sfSignature = make::one<STBlob>(&sfSignature, STI_VL, 6, "Signature", SField::sMD_Default, SField::notSigning);
|
||||
@@ -190,6 +190,9 @@ SField const sfMemoType = make::one(&sfMemoType, STI_VL
|
||||
SField const sfMemoData = make::one(&sfMemoData, STI_VL, 13, "MemoData");
|
||||
SField const sfMemoFormat = make::one(&sfMemoFormat, STI_VL, 14, "MemoFormat");
|
||||
|
||||
// variable length (uncommon)
|
||||
SField const sfMultiSignature = make::one(&sfMultiSignature, STI_VL, 16, "MultiSignature");
|
||||
|
||||
// account
|
||||
SField const sfAccount = make::one(&sfAccount, STI_ACCOUNT, 1, "Account");
|
||||
SField const sfOwner = make::one(&sfOwner, STI_ACCOUNT, 2, "Owner");
|
||||
@@ -219,10 +222,14 @@ SField const sfTemplateEntry = make::one(&sfTemplateEntry, STI_OBJEC
|
||||
SField const sfMemo = make::one(&sfMemo, STI_OBJECT, 10, "Memo");
|
||||
SField const sfSignerEntry = make::one(&sfSignerEntry, STI_OBJECT, 11, "SignerEntry");
|
||||
|
||||
// inner object (uncommon)
|
||||
SField const sfSigningAccount = make::one(&sfSigningAccount, STI_OBJECT, 16, "SigningAccount");
|
||||
SField const sfSigningFor = make::one(&sfSigningFor, STI_OBJECT, 17, "SigningFor");
|
||||
|
||||
// array of objects
|
||||
// ARRAY/1 is reserved for end of array
|
||||
SField const sfSigningAccounts = make::one(&sfSigningAccounts, STI_ARRAY, 2, "SigningAccounts");
|
||||
SField const sfTxnSignatures = make::one(&sfTxnSignatures, STI_ARRAY, 3, "TxnSignatures", SField::sMD_Default, SField::notSigning);
|
||||
SField const sfMultiSigners = make::one(&sfMultiSigners, STI_ARRAY, 3, "MultiSigners", SField::sMD_Default, SField::notSigning);
|
||||
SField const sfSignerEntries = make::one(&sfSignerEntries, STI_ARRAY, 4, "SignerEntries");
|
||||
SField const sfTemplate = make::one(&sfTemplate, STI_ARRAY, 5, "Template");
|
||||
SField const sfNecessary = make::one(&sfNecessary, STI_ARRAY, 6, "Necessary");
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <ripple/basics/Log.h>
|
||||
#include <ripple/json/json_reader.h>
|
||||
#include <ripple/json/to_string.h>
|
||||
#include <ripple/protocol/HashPrefix.h>
|
||||
#include <ripple/protocol/InnerObjectFormats.h>
|
||||
#include <ripple/protocol/STBase.h>
|
||||
#include <ripple/protocol/STAccount.h>
|
||||
@@ -337,6 +338,34 @@ uint256 STObject::getSigningHash (std::uint32_t prefix) const
|
||||
return s.getSHA512Half ();
|
||||
}
|
||||
|
||||
Serializer
|
||||
STObject::startMultiSigningData () const
|
||||
{
|
||||
Serializer s;
|
||||
s.add32 (HashPrefix::txMultiSign);
|
||||
add (s, false);
|
||||
return s;
|
||||
}
|
||||
|
||||
void
|
||||
STObject::finishMultiSigningData (
|
||||
RippleAddress const& signingForID,
|
||||
RippleAddress const& signingID,
|
||||
Serializer& s) const
|
||||
{
|
||||
s.add160 (signingForID.getAccountID ());
|
||||
s.add160 (signingID.getAccountID ());
|
||||
}
|
||||
|
||||
Serializer
|
||||
STObject::getMultiSigningData (
|
||||
RippleAddress const& signingForID, RippleAddress const& signingID) const
|
||||
{
|
||||
Serializer s (startMultiSigningData ());
|
||||
finishMultiSigningData (signingForID, signingID, s);
|
||||
return s;
|
||||
}
|
||||
|
||||
int STObject::getFieldIndex (SField const& field) const
|
||||
{
|
||||
if (mType != nullptr)
|
||||
|
||||
Reference in New Issue
Block a user