mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-12 11:19:08 -05:00
Use 71 byte signature for DUMMY_SIGNATURE_CREATOR
Changes DUMMY_SIGNATURE_CREATOR to create 71 byte dummy signatures. Update comments to reflect this change
This commit is contained in:
parent
18dfea0dd0
commit
48b1473c89
3 changed files with 10 additions and 10 deletions
|
@ -423,16 +423,16 @@ public:
|
||||||
bool CreateSig(const SigningProvider& provider, std::vector<unsigned char>& vchSig, const CKeyID& keyid, const CScript& scriptCode, SigVersion sigversion) const override
|
bool CreateSig(const SigningProvider& provider, std::vector<unsigned char>& vchSig, const CKeyID& keyid, const CScript& scriptCode, SigVersion sigversion) const override
|
||||||
{
|
{
|
||||||
// Create a dummy signature that is a valid DER-encoding
|
// Create a dummy signature that is a valid DER-encoding
|
||||||
vchSig.assign(72, '\000');
|
vchSig.assign(71, '\000');
|
||||||
vchSig[0] = 0x30;
|
vchSig[0] = 0x30;
|
||||||
vchSig[1] = 69;
|
vchSig[1] = 68;
|
||||||
vchSig[2] = 0x02;
|
vchSig[2] = 0x02;
|
||||||
vchSig[3] = 33;
|
vchSig[3] = 32;
|
||||||
vchSig[4] = 0x01;
|
vchSig[4] = 0x01;
|
||||||
vchSig[4 + 33] = 0x02;
|
vchSig[4 + 32] = 0x02;
|
||||||
vchSig[5 + 33] = 32;
|
vchSig[5 + 32] = 32;
|
||||||
vchSig[6 + 33] = 0x01;
|
vchSig[6 + 32] = 0x01;
|
||||||
vchSig[6 + 33 + 32] = SIGHASH_ALL;
|
vchSig[6 + 32 + 32] = SIGHASH_ALL;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1540,7 +1540,7 @@ int64_t CWalletTx::GetTxTime() const
|
||||||
return n ? n : nTimeReceived;
|
return n ? n : nTimeReceived;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper for producing a max-sized low-S signature (eg 72 bytes)
|
// Helper for producing a max-sized low-S low-R signature (eg 71 bytes)
|
||||||
bool CWallet::DummySignInput(CTxIn &tx_in, const CTxOut &txout) const
|
bool CWallet::DummySignInput(CTxIn &tx_in, const CTxOut &txout) const
|
||||||
{
|
{
|
||||||
// Fill in dummy signatures for fee calculation.
|
// Fill in dummy signatures for fee calculation.
|
||||||
|
@ -1556,7 +1556,7 @@ bool CWallet::DummySignInput(CTxIn &tx_in, const CTxOut &txout) const
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper for producing a bunch of max-sized low-S signatures (eg 72 bytes)
|
// Helper for producing a bunch of max-sized low-S low-R signatures (eg 71 bytes)
|
||||||
bool CWallet::DummySignTx(CMutableTransaction &txNew, const std::vector<CTxOut> &txouts) const
|
bool CWallet::DummySignTx(CMutableTransaction &txNew, const std::vector<CTxOut> &txouts) const
|
||||||
{
|
{
|
||||||
// Fill in dummy signatures for fee calculation.
|
// Fill in dummy signatures for fee calculation.
|
||||||
|
|
|
@ -1308,7 +1308,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
// Calculate the size of the transaction assuming all signatures are max size
|
// Calculate the size of the transaction assuming all signatures are max size
|
||||||
// Use DummySignatureCreator, which inserts 72 byte signatures everywhere.
|
// Use DummySignatureCreator, which inserts 71 byte signatures everywhere.
|
||||||
// NOTE: this requires that all inputs must be in mapWallet (eg the tx should
|
// NOTE: this requires that all inputs must be in mapWallet (eg the tx should
|
||||||
// be IsAllFromMe).
|
// be IsAllFromMe).
|
||||||
int64_t CalculateMaximumSignedTxSize(const CTransaction &tx, const CWallet *wallet);
|
int64_t CalculateMaximumSignedTxSize(const CTransaction &tx, const CWallet *wallet);
|
||||||
|
|
Loading…
Add table
Reference in a new issue