mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Track STTx validity with HashRouter. (RIPD-977)
This commit is contained in:
@@ -129,23 +129,6 @@ public:
|
||||
#endif
|
||||
) const;
|
||||
|
||||
bool isKnownGood () const
|
||||
{
|
||||
return (sig_state_ == true);
|
||||
}
|
||||
bool isKnownBad () const
|
||||
{
|
||||
return (sig_state_ == false);
|
||||
}
|
||||
void setGood () const
|
||||
{
|
||||
sig_state_ = true;
|
||||
}
|
||||
void setBad () const
|
||||
{
|
||||
sig_state_ = false;
|
||||
}
|
||||
|
||||
// SQL Functions with metadata.
|
||||
static
|
||||
std::string const&
|
||||
@@ -165,12 +148,18 @@ private:
|
||||
bool checkMultiSign () const;
|
||||
|
||||
TxType tx_type_;
|
||||
|
||||
mutable boost::tribool sig_state_;
|
||||
};
|
||||
|
||||
bool passesLocalChecks (STObject const& st, std::string&);
|
||||
|
||||
using SigVerify = std::function < bool(STTx const&, std::function<bool(STTx const&)>) > ;
|
||||
|
||||
inline
|
||||
bool directSigVerify(STTx const& tx, std::function<bool(STTx const&)> sigCheck)
|
||||
{
|
||||
return sigCheck(tx);
|
||||
}
|
||||
|
||||
} // ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -39,7 +39,6 @@ namespace ripple {
|
||||
STTx::STTx (TxType type)
|
||||
: STObject (sfTransaction)
|
||||
, tx_type_ (type)
|
||||
, sig_state_ (boost::indeterminate)
|
||||
{
|
||||
auto format = TxFormats::getInstance().findByType (type);
|
||||
|
||||
@@ -56,7 +55,6 @@ STTx::STTx (TxType type)
|
||||
|
||||
STTx::STTx (STObject&& object)
|
||||
: STObject (std::move (object))
|
||||
, sig_state_ (boost::indeterminate)
|
||||
{
|
||||
tx_type_ = static_cast <TxType> (getFieldU16 (sfTransactionType));
|
||||
|
||||
@@ -79,7 +77,6 @@ STTx::STTx (STObject&& object)
|
||||
|
||||
STTx::STTx (SerialIter& sit)
|
||||
: STObject (sfTransaction)
|
||||
, sig_state_ (boost::indeterminate)
|
||||
{
|
||||
int length = sit.getBytesLeft ();
|
||||
|
||||
@@ -186,33 +183,27 @@ void STTx::sign (RippleAddress const& private_key)
|
||||
|
||||
bool STTx::checkSign(bool allowMultiSign) const
|
||||
{
|
||||
if (boost::indeterminate (sig_state_))
|
||||
bool sigGood = false;
|
||||
try
|
||||
{
|
||||
try
|
||||
if (allowMultiSign)
|
||||
{
|
||||
if (allowMultiSign)
|
||||
{
|
||||
// Determine whether we're single- or multi-signing by looking
|
||||
// at the SigningPubKey. It it's empty we must be multi-signing.
|
||||
// Otherwise we're single-signing.
|
||||
Blob const& signingPubKey = getFieldVL (sfSigningPubKey);
|
||||
sig_state_ = signingPubKey.empty () ?
|
||||
checkMultiSign () : checkSingleSign ();
|
||||
}
|
||||
else
|
||||
{
|
||||
sig_state_ = checkSingleSign ();
|
||||
}
|
||||
// Determine whether we're single- or multi-signing by looking
|
||||
// at the SigningPubKey. It it's empty we must be multi-signing.
|
||||
// Otherwise we're single-signing.
|
||||
Blob const& signingPubKey = getFieldVL (sfSigningPubKey);
|
||||
sigGood = signingPubKey.empty () ?
|
||||
checkMultiSign () : checkSingleSign ();
|
||||
}
|
||||
catch (...)
|
||||
else
|
||||
{
|
||||
sig_state_ = false;
|
||||
sigGood = checkSingleSign ();
|
||||
}
|
||||
}
|
||||
|
||||
assert (!boost::indeterminate (sig_state_));
|
||||
|
||||
return static_cast<bool> (sig_state_);
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
return sigGood;
|
||||
}
|
||||
|
||||
void STTx::setSigningPubKey (RippleAddress const& naSignPubKey)
|
||||
|
||||
Reference in New Issue
Block a user