2020
2121typedef std::vector<unsigned char > valtype;
2222
23- MutableTransactionSignatureCreator::MutableTransactionSignatureCreator (const CMutableTransaction& tx, unsigned int input_idx, const CAmount& amount, int hash_type )
24- : m_txto{tx}, nIn{input_idx}, nHashType{hash_type }, amount{amount}, checker{&m_txto, nIn, amount, MissingDataBehavior::FAIL},
23+ MutableTransactionSignatureCreator::MutableTransactionSignatureCreator (const CMutableTransaction& tx, unsigned int input_idx, const CAmount& amount, const SignOptions options )
24+ : m_txto{tx}, nIn{input_idx}, m_options{options }, amount{amount}, checker{&m_txto, nIn, amount, MissingDataBehavior::FAIL},
2525 m_txdata (nullptr )
2626{
2727}
2828
29- MutableTransactionSignatureCreator::MutableTransactionSignatureCreator (const CMutableTransaction& tx, unsigned int input_idx, const CAmount& amount, const PrecomputedTransactionData* txdata, int hash_type )
30- : m_txto{tx}, nIn{input_idx}, nHashType{hash_type }, amount{amount},
29+ MutableTransactionSignatureCreator::MutableTransactionSignatureCreator (const CMutableTransaction& tx, unsigned int input_idx, const CAmount& amount, const PrecomputedTransactionData* txdata, const SignOptions options )
30+ : m_txto{tx}, nIn{input_idx}, m_options{options }, amount{amount},
3131 checker{txdata ? MutableTransactionSignatureChecker{&m_txto, nIn, amount, *txdata, MissingDataBehavior::FAIL} :
3232 MutableTransactionSignatureChecker{&m_txto, nIn, amount, MissingDataBehavior::FAIL}},
3333 m_txdata (txdata)
@@ -50,7 +50,7 @@ bool MutableTransactionSignatureCreator::CreateSig(const SigningProvider& provid
5050 if (sigversion == SigVersion::WITNESS_V0 && !MoneyRange (amount)) return false ;
5151
5252 // BASE/WITNESS_V0 signatures don't support explicit SIGHASH_DEFAULT, use SIGHASH_ALL instead.
53- const int hashtype = nHashType == SIGHASH_DEFAULT ? SIGHASH_ALL : nHashType ;
53+ const int hashtype = m_options. sighash_type == SIGHASH_DEFAULT ? SIGHASH_ALL : m_options. sighash_type ;
5454
5555 uint256 hash = SignatureHash (scriptCode, m_txto, nIn, hashtype, amount, sigversion, m_txdata);
5656 if (!key.Sign (hash, vchSig))
@@ -82,11 +82,11 @@ bool MutableTransactionSignatureCreator::CreateSchnorrSig(const SigningProvider&
8282 execdata.m_tapleaf_hash = *leaf_hash;
8383 }
8484 uint256 hash;
85- if (!SignatureHashSchnorr (hash, execdata, m_txto, nIn, nHashType , sigversion, *m_txdata, MissingDataBehavior::FAIL)) return false ;
85+ if (!SignatureHashSchnorr (hash, execdata, m_txto, nIn, m_options. sighash_type , sigversion, *m_txdata, MissingDataBehavior::FAIL)) return false ;
8686 sig.resize (64 );
8787 // Use uint256{} as aux_rnd for now.
8888 if (!key.SignSchnorr (hash, sig, merkle_root, {})) return false ;
89- if (nHashType ) sig.push_back (nHashType );
89+ if (m_options. sighash_type ) sig.push_back (m_options. sighash_type );
9090 return true ;
9191}
9292
@@ -801,7 +801,7 @@ bool SignTransaction(CMutableTransaction& mtx, const SigningProvider* keystore,
801801 SignatureData sigdata = DataFromTransaction (mtx, i, coin->second .out );
802802 // Only sign SIGHASH_SINGLE if there's a corresponding output:
803803 if (!fHashSingle || (i < mtx.vout .size ())) {
804- ProduceSignature (*keystore, MutableTransactionSignatureCreator (mtx, i, amount, &txdata, options. sighash_type ), prevPubKey, sigdata);
804+ ProduceSignature (*keystore, MutableTransactionSignatureCreator (mtx, i, amount, &txdata, options), prevPubKey, sigdata);
805805 }
806806
807807 UpdateInput (txin, sigdata);
0 commit comments