diff options
author | Martin Ankerl <martin.ankerl@gmail.com> | 2018-05-20 22:47:14 +0200 |
---|---|---|
committer | Martin Ankerl <martin.ankerl@gmail.com> | 2018-05-30 16:01:36 +0200 |
commit | 6b8b63af1461dc11ffd813401e2c36fa44656715 (patch) | |
tree | 7a18974032bb6d1a67fbe78b0a7863f72603aa65 /src/script/sign.h | |
parent | d792e47421fcb9ce3b381c1e6d8902777ae3f9f3 (diff) | |
download | bitcoin-6b8b63af1461dc11ffd813401e2c36fa44656715.tar.xz |
Generic TransactionSignatureCreator works with both CTransaction and CMutableTransaction
Templated version so that no copying of CMutableTransaction into a CTransaction is
necessary. This speeds up the test case transaction_tests/test_big_witness_transaction
from 7.9 seconds to 3.1 seconds on my machine.
Diffstat (limited to 'src/script/sign.h')
-rw-r--r-- | src/script/sign.h | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/script/sign.h b/src/script/sign.h index cf3651c1de..a10366dcd1 100644 --- a/src/script/sign.h +++ b/src/script/sign.h @@ -37,26 +37,19 @@ public: }; /** A signature creator for transactions. */ -class TransactionSignatureCreator : public BaseSignatureCreator { - const CTransaction* txTo; +class MutableTransactionSignatureCreator : public BaseSignatureCreator { + const CMutableTransaction* txTo; unsigned int nIn; int nHashType; CAmount amount; - const TransactionSignatureChecker checker; + const MutableTransactionSignatureChecker checker; public: - TransactionSignatureCreator(const CTransaction* txToIn, unsigned int nInIn, const CAmount& amountIn, int nHashTypeIn=SIGHASH_ALL); + MutableTransactionSignatureCreator(const CMutableTransaction* txToIn, unsigned int nInIn, const CAmount& amountIn, int nHashTypeIn = SIGHASH_ALL); const BaseSignatureChecker& Checker() const override { return checker; } bool CreateSig(const SigningProvider& provider, std::vector<unsigned char>& vchSig, const CKeyID& keyid, const CScript& scriptCode, SigVersion sigversion) const override; }; -class MutableTransactionSignatureCreator : public TransactionSignatureCreator { - CTransaction tx; - -public: - MutableTransactionSignatureCreator(const CMutableTransaction* txToIn, unsigned int nInIn, const CAmount& amountIn, int nHashTypeIn) : TransactionSignatureCreator(&tx, nInIn, amountIn, nHashTypeIn), tx(*txToIn) {} -}; - /** A signature creator that just produces 72-byte empty signatures. */ extern const BaseSignatureCreator& DUMMY_SIGNATURE_CREATOR; |