xrpld
Loading...
Searching...
No Matches
ProposalHelpers.h
1#pragma once
2
3#include <xrpl/protocol/SField.h>
4#include <xrpl/protocol/STObject.h>
5#include <xrpl/protocol/TxFormats.h>
6
7#include <cstdint>
8
9namespace xrpl::proposal {
10
15
22
26inline std::uint32_t
27proposalOwnerCount(STObject const& proposedTx)
28{
29 return proposedTx.getFieldU16(sfTransactionType) == ttBATCH ? kBatchProposalOwnerCount
31}
32
40inline bool
41isProposalTx(STObject const& proposedTx)
42{
43 return proposedTx.getFieldU16(sfTransactionType) == ttTRANSACTION_PROPOSAL_CREATE;
44}
45
56bool
57isValidProposal(STObject const& proposedTx);
58
66inline bool
67hasSignatureField(STObject const& proposedTx)
68{
69 return proposedTx.isFieldPresent(sfTxnSignature) || proposedTx.isFieldPresent(sfSigners) ||
70 proposedTx.isFieldPresent(sfBatchSigners) ||
71 proposedTx.isFieldPresent(sfCounterpartySignature) ||
72 proposedTx.isFieldPresent(sfSponsorSignature);
73}
74
80inline bool
82{
83 return proposedTx.isFieldPresent(sfSigningPubKey) &&
84 proposedTx.getFieldVL(sfSigningPubKey).empty();
85}
86
87} // namespace xrpl::proposal
Blob getFieldVL(SField const &field) const
Definition STObject.cpp:649
bool isFieldPresent(SField const &field) const
Definition STObject.cpp:464
std::uint16_t getFieldU16(SField const &field) const
Definition STObject.cpp:595
T empty(T... args)
std::uint32_t proposalOwnerCount(STObject const &proposedTx)
Owner-reserve increments held by a proposal of the given transaction.
bool hasSignatureField(STObject const &proposedTx)
Whether the proposed transaction carries any signature field.
constexpr std::uint32_t kBatchProposalOwnerCount
Owner-reserve increments held by a proposal of a Batch transaction.
constexpr std::uint32_t kProposalOwnerCount
Owner-reserve increments held by a proposal of an ordinary transaction.
bool isValidProposal(STObject const &proposedTx)
Whether the proposed transaction is independently submittable through the ordinary multi-sign path: n...
bool isProposalTx(STObject const &proposedTx)
Whether the proposed transaction is itself a proposal transaction, which would nest one proposal insi...
bool hasEmptySigningPubKey(STObject const &proposedTx)
Whether the proposed transaction's SigningPubKey is present and empty, as unsigned canonical form req...