Reduce unnecessary hashing in signrawtransaction #8118

pull jonasnick wants to merge 1 commits into bitcoin:master from jonasnick:faster-signraw changing 1 files +5 −2
  1. jonasnick commented at 10:14 AM on May 30, 2016: contributor

    When calling CombineSignatures and VerifyScript inside signrawtransaction with a CMutableTransaction, the tx is converted into a CTransaction which requires hashing. Because both CombineSignatures and VerifyScript accept the scriptSig created by SignSignature separately from the transaction we can instead convert the mutable tx to CTransaction once and use that one.

    Results: 1000 inputs, 75kB before signing: 2.86s vs. 4.88s Signature concatenation of three 250kB transactions with 1000 inputs: 8.638s vs. 19.142s

    There still remains some unnecessary hashing, but fixing this requires a larger refactor: SignSignature requires a CMutableTransaction because it changes the scriptSig in place. But it also immediately creates a CTransaction (costly) for a TransactionSignatureChecker. Using a MutableTransactionSignatureChecker is not an option because it immediately converts the mutable transaction to a CTransaction. Instead, the TransactionSignatureChecker should be able to deal with CMutableTransaction without rehashing.

  2. Reduce unnecessary hashing in signrawtransaction bd0f413877
  3. sipa commented at 12:38 PM on May 30, 2016: member

    utACK bd0f41387783ee91623d7fac15e89e57db37df82

  4. jonasschnelli commented at 1:09 PM on June 2, 2016: contributor

    utACK bd0f41387783ee91623d7fac15e89e57db37df82

  5. dcousens commented at 3:04 PM on June 2, 2016: contributor

    utACK bd0f413

  6. dcousens commented at 3:06 PM on June 2, 2016: contributor

    Probably worth noting, from my searches, it appears that MutableTransactionSignatureChecker is [now] only used by bitcoin-tx...

  7. laanwj commented at 12:34 PM on June 7, 2016: member

    utACK bd0f413

    Probably worth noting, from my searches, it appears that MutableTransactionSignatureChecker is [now] only used by bitcoin-tx...

    Good observation, I suppose it could be moved, or maybe the use there could be avoided too and then removed.

  8. laanwj merged this on Jun 7, 2016
  9. laanwj closed this on Jun 7, 2016

  10. laanwj referenced this in commit 9b6a48c2e9 on Jun 7, 2016
  11. codablock referenced this in commit b34345369e on Sep 16, 2017
  12. codablock referenced this in commit 79ac31effa on Sep 19, 2017
  13. codablock referenced this in commit 7f0213ac3e on Dec 22, 2017
  14. zkbot referenced this in commit 84c19b8a87 on Feb 8, 2018
  15. zkbot referenced this in commit e1f3a15fdc on Feb 8, 2018
  16. zkbot referenced this in commit eb3128ab0a on Feb 19, 2018
  17. zkbot referenced this in commit 6db10127a9 on Feb 20, 2018
  18. zkbot referenced this in commit 8487be8360 on Feb 20, 2018
  19. andvgal referenced this in commit 5e3f0361e5 on Jan 6, 2019
  20. random-zebra referenced this in commit 5a092159f6 on Aug 5, 2020
  21. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 15:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me