Allow multi-sign to be enabled at runtime:

This lets unit tests exercise multi-sign interfaces
without having to set RIPPLE_MULTI_SIGN_ENABLE.
This commit is contained in:
Vinnie Falco
2015-05-31 18:55:55 -07:00
parent 8be4e7e65f
commit 269ad321e6
5 changed files with 53 additions and 22 deletions

View File

@@ -190,22 +190,25 @@ void STTx::sign (RippleAddress const& private_key)
setFieldVL (sfTxnSignature, signature);
}
bool STTx::checkSign () const
bool STTx::checkSign(bool allowMultiSign) const
{
if (boost::indeterminate (sig_state_))
{
try
{
#if RIPPLE_ENABLE_MULTI_SIGN
// 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 ();
#endif // RIPPLE_ENABLE_MULTI_SIGN
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 ();
}
}
catch (...)
{