Skip to content

Commit 48b1473

Browse files
committed
Use 71 byte signature for DUMMY_SIGNATURE_CREATOR
Changes DUMMY_SIGNATURE_CREATOR to create 71 byte dummy signatures. Update comments to reflect this change
1 parent 18dfea0 commit 48b1473

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

src/script/sign.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -423,16 +423,16 @@ class DummySignatureCreator final : public BaseSignatureCreator {
423423
bool CreateSig(const SigningProvider& provider, std::vector<unsigned char>& vchSig, const CKeyID& keyid, const CScript& scriptCode, SigVersion sigversion) const override
424424
{
425425
// Create a dummy signature that is a valid DER-encoding
426-
vchSig.assign(72, '\000');
426+
vchSig.assign(71, '\000');
427427
vchSig[0] = 0x30;
428-
vchSig[1] = 69;
428+
vchSig[1] = 68;
429429
vchSig[2] = 0x02;
430-
vchSig[3] = 33;
430+
vchSig[3] = 32;
431431
vchSig[4] = 0x01;
432-
vchSig[4 + 33] = 0x02;
433-
vchSig[5 + 33] = 32;
434-
vchSig[6 + 33] = 0x01;
435-
vchSig[6 + 33 + 32] = SIGHASH_ALL;
432+
vchSig[4 + 32] = 0x02;
433+
vchSig[5 + 32] = 32;
434+
vchSig[6 + 32] = 0x01;
435+
vchSig[6 + 32 + 32] = SIGHASH_ALL;
436436
return true;
437437
}
438438
};

src/wallet/wallet.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1540,7 +1540,7 @@ int64_t CWalletTx::GetTxTime() const
15401540
return n ? n : nTimeReceived;
15411541
}
15421542

1543-
// Helper for producing a max-sized low-S signature (eg 72 bytes)
1543+
// Helper for producing a max-sized low-S low-R signature (eg 71 bytes)
15441544
bool CWallet::DummySignInput(CTxIn &tx_in, const CTxOut &txout) const
15451545
{
15461546
// Fill in dummy signatures for fee calculation.
@@ -1556,7 +1556,7 @@ bool CWallet::DummySignInput(CTxIn &tx_in, const CTxOut &txout) const
15561556
return true;
15571557
}
15581558

1559-
// Helper for producing a bunch of max-sized low-S signatures (eg 72 bytes)
1559+
// Helper for producing a bunch of max-sized low-S low-R signatures (eg 71 bytes)
15601560
bool CWallet::DummySignTx(CMutableTransaction &txNew, const std::vector<CTxOut> &txouts) const
15611561
{
15621562
// Fill in dummy signatures for fee calculation.

src/wallet/wallet.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1308,7 +1308,7 @@ class WalletRescanReserver
13081308
};
13091309

13101310
// Calculate the size of the transaction assuming all signatures are max size
1311-
// Use DummySignatureCreator, which inserts 72 byte signatures everywhere.
1311+
// Use DummySignatureCreator, which inserts 71 byte signatures everywhere.
13121312
// NOTE: this requires that all inputs must be in mapWallet (eg the tx should
13131313
// be IsAllFromMe).
13141314
int64_t CalculateMaximumSignedTxSize(const CTransaction &tx, const CWallet *wallet);

0 commit comments

Comments
 (0)