Skip to content

Commit 398fd63

Browse files
author
MarcoFalke
committed
Merge bitcoin/bitcoin#23525: doc: Pick better named args for MutableTransactionSignatureCreator
fa54a40 doc: Pick better named args for MutableTransactionSignatureCreator (MarcoFalke) Pull request description: Argument names of `nInIn` are not helpful. ACKs for top commit: shaavan: ACK fa54a40 achow101: ACK fa54a40 Tree-SHA512: 53a38588fdee07d7896a66339c1c2c2355638db95a95cad9844b60cd34e935bb726ab64d0c42dc414beb35375e56440f8a9cb3fbf5aec55c1eed066b7acad8c8
2 parents cb2392c + fa54a40 commit 398fd63

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/psbt.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ void UpdatePSBTOutput(const SigningProvider& provider, PartiallySignedTransactio
223223
// Construct a would-be spend of this output, to update sigdata with.
224224
// Note that ProduceSignature is used to fill in metadata (not actual signatures),
225225
// so provider does not need to provide any private keys (it can be a HidingSigningProvider).
226-
MutableTransactionSignatureCreator creator(&tx, /* index */ 0, out.nValue, SIGHASH_ALL);
226+
MutableTransactionSignatureCreator creator(&tx, /*input_idx=*/0, out.nValue, SIGHASH_ALL);
227227
ProduceSignature(provider, creator, out.scriptPubKey, sigdata);
228228

229229
// Put redeem_script, witness_script, key paths, into PSBTOutput.

src/script/sign.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@
1717

1818
typedef std::vector<unsigned char> valtype;
1919

20-
MutableTransactionSignatureCreator::MutableTransactionSignatureCreator(const CMutableTransaction* txToIn, unsigned int nInIn, const CAmount& amountIn, int nHashTypeIn)
21-
: txTo(txToIn), nIn(nInIn), nHashType(nHashTypeIn), amount(amountIn), checker(txTo, nIn, amountIn, MissingDataBehavior::FAIL),
20+
MutableTransactionSignatureCreator::MutableTransactionSignatureCreator(const CMutableTransaction* tx, unsigned int input_idx, const CAmount& amount, int hash_type)
21+
: txTo{tx}, nIn{input_idx}, nHashType{hash_type}, amount{amount}, checker{txTo, nIn, amount, MissingDataBehavior::FAIL},
2222
m_txdata(nullptr)
2323
{
2424
}
2525

26-
MutableTransactionSignatureCreator::MutableTransactionSignatureCreator(const CMutableTransaction* txToIn, unsigned int nInIn, const CAmount& amountIn, const PrecomputedTransactionData* txdata, int nHashTypeIn)
27-
: txTo(txToIn), nIn(nInIn), nHashType(nHashTypeIn), amount(amountIn),
28-
checker(txdata ? MutableTransactionSignatureChecker(txTo, nIn, amount, *txdata, MissingDataBehavior::FAIL) :
29-
MutableTransactionSignatureChecker(txTo, nIn, amount, MissingDataBehavior::FAIL)),
26+
MutableTransactionSignatureCreator::MutableTransactionSignatureCreator(const CMutableTransaction* tx, unsigned int input_idx, const CAmount& amount, const PrecomputedTransactionData* txdata, int hash_type)
27+
: txTo{tx}, nIn{input_idx}, nHashType{hash_type}, amount{amount},
28+
checker{txdata ? MutableTransactionSignatureChecker{txTo, nIn, amount, *txdata, MissingDataBehavior::FAIL} :
29+
MutableTransactionSignatureChecker{txTo, nIn, amount, MissingDataBehavior::FAIL}},
3030
m_txdata(txdata)
3131
{
3232
}

src/script/sign.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ class MutableTransactionSignatureCreator : public BaseSignatureCreator {
4545
const PrecomputedTransactionData* m_txdata;
4646

4747
public:
48-
MutableTransactionSignatureCreator(const CMutableTransaction* txToIn, unsigned int nInIn, const CAmount& amountIn, int nHashTypeIn);
49-
MutableTransactionSignatureCreator(const CMutableTransaction* txToIn, unsigned int nInIn, const CAmount& amountIn, const PrecomputedTransactionData* txdata, int nHashTypeIn);
48+
MutableTransactionSignatureCreator(const CMutableTransaction* tx, unsigned int input_idx, const CAmount& amount, int hash_type);
49+
MutableTransactionSignatureCreator(const CMutableTransaction* tx, unsigned int input_idx, const CAmount& amount, const PrecomputedTransactionData* txdata, int hash_type);
5050
const BaseSignatureChecker& Checker() const override { return checker; }
5151
bool CreateSig(const SigningProvider& provider, std::vector<unsigned char>& vchSig, const CKeyID& keyid, const CScript& scriptCode, SigVersion sigversion) const override;
5252
bool CreateSchnorrSig(const SigningProvider& provider, std::vector<unsigned char>& sig, const XOnlyPubKey& pubkey, const uint256* leaf_hash, const uint256* merkle_root, SigVersion sigversion) const override;

0 commit comments

Comments
 (0)