Skip to content

Commit 27c6fc7

Browse files
MarcoFalkeknst
authored andcommitted
Merge 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
1 parent 130ac16 commit 27c6fc7

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
@@ -205,7 +205,7 @@ void UpdatePSBTOutput(const SigningProvider& provider, PartiallySignedTransactio
205205
// Construct a would-be spend of this output, to update sigdata with.
206206
// Note that ProduceSignature is used to fill in metadata (not actual signatures),
207207
// so provider does not need to provide any private keys (it can be a HidingSigningProvider).
208-
MutableTransactionSignatureCreator creator(&tx, /* index */ 0, out.nValue, SIGHASH_ALL);
208+
MutableTransactionSignatureCreator creator(&tx, /*input_idx=*/0, out.nValue, SIGHASH_ALL);
209209
ProduceSignature(provider, creator, out.scriptPubKey, sigdata);
210210

211211
// Put redeem_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
@@ -42,8 +42,8 @@ class MutableTransactionSignatureCreator : public BaseSignatureCreator {
4242
const PrecomputedTransactionData* m_txdata;
4343

4444
public:
45-
MutableTransactionSignatureCreator(const CMutableTransaction* txToIn, unsigned int nInIn, const CAmount& amountIn, int nHashTypeIn = SIGHASH_ALL);
46-
MutableTransactionSignatureCreator(const CMutableTransaction* txToIn, unsigned int nInIn, const CAmount& amountIn, const PrecomputedTransactionData* txdata, int nHashTypeIn = SIGHASH_ALL);
45+
MutableTransactionSignatureCreator(const CMutableTransaction* txToIn, unsigned int input_idx, const CAmount& amountIn, int nHashTypeIn = SIGHASH_ALL);
46+
MutableTransactionSignatureCreator(const CMutableTransaction* txToIn, unsigned int input_idx, const CAmount& amountIn, const PrecomputedTransactionData* txdata, int nHashTypeIn = SIGHASH_ALL);
4747
const BaseSignatureChecker& Checker() const override { return checker; }
4848
bool CreateSig(const SigningProvider& provider, std::vector<unsigned char>& vchSig, const CKeyID& keyid, const CScript& scriptCode, SigVersion sigversion) const override;
4949
};

0 commit comments

Comments
 (0)