mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Combine STTx::checkSign overloads:
Callers don't need to specify the signing key -- they're just retrieving the key from the SerializedTransaction and then passing it back. This simplifies Ed25519 implementation.
This commit is contained in:
@@ -251,7 +251,7 @@ TER Transactor::preCheck ()
|
||||
if (!mTxn.isKnownGood ())
|
||||
{
|
||||
if (mTxn.isKnownBad () ||
|
||||
(!(mParams & tapNO_CHECK_SIGN) && !mTxn.checkSign (mSigningPubKey)))
|
||||
(!(mParams & tapNO_CHECK_SIGN) && !mTxn.checkSign()))
|
||||
{
|
||||
mTxn.setBad ();
|
||||
m_journal.warning << "apply: Invalid transaction (bad signature)";
|
||||
|
||||
@@ -69,7 +69,7 @@ Transaction::pointer Transaction::sharedTransaction (
|
||||
bool Transaction::checkSign () const
|
||||
{
|
||||
if (mFromPubKey.isValid ())
|
||||
return mTransaction->checkSign (mFromPubKey);
|
||||
return mTransaction->checkSign();
|
||||
|
||||
WriteLog (lsWARNING, Ledger) << "Transaction has bad source public key";
|
||||
return false;
|
||||
|
||||
@@ -111,7 +111,6 @@ public:
|
||||
void sign (RippleAddress const& private_key);
|
||||
|
||||
bool checkSign () const;
|
||||
bool checkSign (RippleAddress const& public_key) const;
|
||||
|
||||
bool isKnownGood () const
|
||||
{
|
||||
|
||||
@@ -181,10 +181,15 @@ bool STTx::checkSign () const
|
||||
{
|
||||
try
|
||||
{
|
||||
ECDSA const fullyCanonical = (getFlags() & tfFullyCanonicalSig)
|
||||
? ECDSA::strict
|
||||
: ECDSA::not_strict;
|
||||
|
||||
RippleAddress n;
|
||||
n.setAccountPublic (getFieldVL (sfSigningPubKey));
|
||||
|
||||
sig_state_ = checkSign (n);
|
||||
sig_state_ = n.accountPublicVerify (getSigningHash (),
|
||||
getFieldVL (sfTxnSignature), fullyCanonical);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
@@ -197,23 +202,6 @@ bool STTx::checkSign () const
|
||||
return static_cast<bool> (sig_state_);
|
||||
}
|
||||
|
||||
bool STTx::checkSign (RippleAddress const& public_key) const
|
||||
{
|
||||
try
|
||||
{
|
||||
ECDSA const fullyCanonical = (getFlags() & tfFullyCanonicalSig)
|
||||
? ECDSA::strict
|
||||
: ECDSA::not_strict;
|
||||
|
||||
return public_key.accountPublicVerify (getSigningHash (),
|
||||
getFieldVL (sfTxnSignature), fullyCanonical);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void STTx::setSigningPubKey (RippleAddress const& naSignPubKey)
|
||||
{
|
||||
setFieldVL (sfSigningPubKey, naSignPubKey.getAccountPublic ());
|
||||
|
||||
Reference in New Issue
Block a user