mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-15 07:03:40 +01:00
Drop UpdateTransaction in favor of UpdateInput
Updating the input explicitly requires the caller to present a mutable input, which more clearly communicates the effects and intent of the method. In most cases, this input is already immediately available and need not be looked up.
This commit is contained in:
@@ -199,12 +199,6 @@ void UpdateInput(CTxIn& input, const SignatureData& data)
|
||||
input.scriptWitness = data.scriptWitness;
|
||||
}
|
||||
|
||||
void UpdateTransaction(CMutableTransaction& tx, unsigned int nIn, const SignatureData& data)
|
||||
{
|
||||
assert(tx.vin.size() > nIn);
|
||||
UpdateInput(tx.vin[nIn], data);
|
||||
}
|
||||
|
||||
bool SignSignature(const SigningProvider &provider, const CScript& fromPubKey, CMutableTransaction& txTo, unsigned int nIn, const CAmount& amount, int nHashType)
|
||||
{
|
||||
assert(nIn < txTo.vin.size());
|
||||
@@ -214,7 +208,7 @@ bool SignSignature(const SigningProvider &provider, const CScript& fromPubKey, C
|
||||
|
||||
SignatureData sigdata;
|
||||
bool ret = ProduceSignature(provider, creator, fromPubKey, sigdata);
|
||||
UpdateTransaction(txTo, nIn, sigdata);
|
||||
UpdateInput(txTo.vin.at(nIn), sigdata);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user