CBasicKeyStore::AddCScript() : redeemScripts > 520 bytes are invalid #4313

issue gmaxwell opened this issue on June 9, 2014
  1. gmaxwell commented at 6:26 PM on June 9, 2014: contributor

    The extra sanity checking PeterTodd added a while back causes us to crap out while loading wallets which have previously had an excessively large addmultisigaddress done to them.

  2. laanwj added the label Wallet on Jun 9, 2014
  3. laanwj commented at 9:59 PM on June 9, 2014: member

    Do you have a backtrace of the error that happens? I'm not sure how it ends up in that check, in principle loading the wallet shouldn't fail on transactions.

  4. gmaxwell commented at 10:13 PM on June 9, 2014: contributor

    I just threw a breakpoint on AddCScript—

    #0 CBasicKeyStore::AddCScript (this=this@entry=0x55557602e5f0, redeemScript=...) at keystore.cpp:35 #1 0x0000555555790c81 in LoadCScript (redeemScript=..., this=0x55557602e5f0) at wallet.h:214 #2 ReadKeyValue (pwallet=pwallet@entry=0x55557602e5f0, ssKey=..., ssValue=..., wss=..., strType="cscript", strErr="") at walletdb.cpp:547 #3 0x000055555579154b in CWalletDB::LoadWallet (this=this@entry=0x7fffffffbf40, pwallet=pwallet@entry=0x55557602e5f0) at walletdb.cpp:623 #4 0x000055555577b9ee in CWallet::LoadWallet (this=0x55557602e5f0, fFirstRunRet=@0x7fffffffcaa0: false) at wallet.cpp:1475 #5 0x00005555555a5a4b in AppInit2 (threadGroup=...) at init.cpp:975 #6 0x000055555558d513 in AppInit (argc=argc@entry=2, argv=argv@entry=0x7fffffffdd28) at bitcoind.cpp:143 #7 0x000055555558381f in main (argc=2, argv=0x7fffffffdd28) at bitcoind.cpp:180

  5. laanwj commented at 6:23 AM on June 10, 2014: member

    Thanks. I see. This happens while reading the "cscript" record, not while reading a transaction, that's why I couldn't find it.

    What would the right behaviour here?

    • Should we just pretend that these CScripts are not there when loading from an existing wallet (with a warning)?
    • Or should they be force-added, bypassing the check? (this could result in problems later, so I prefer the above)
  6. gmaxwell commented at 6:28 AM on June 10, 2014: contributor

    I think the first. Just ignore them, maybe a warning in the logs. (though we may get complaints that there is a warning with no way to cure it…)

  7. laanwj commented at 7:17 AM on June 10, 2014: member

    Well we could define a new wallet version, ignore them only in the current wallet version (and warn), and make an upgrader that removes them. That would provide an upgrade path to get rid of the warnings.

    But that may be too much. Bumping the wallet version would break compatibility with old wallets for no good reason, for example.

  8. laanwj referenced this in commit 0165f46959 on Jun 10, 2014
  9. laanwj referenced this in commit bec46c1d3e on Jun 10, 2014
  10. laanwj referenced this in commit 039d80658f on Jun 10, 2014
  11. laanwj referenced this in commit c7e26cdcf5 on Jun 10, 2014
  12. laanwj referenced this in commit fd44b68525 on Jun 10, 2014
  13. laanwj referenced this in commit 18116b06c1 on Jun 12, 2014
  14. laanwj closed this on Jun 14, 2014

  15. laanwj referenced this in commit 4b57c5b3c7 on Aug 18, 2014
  16. MathyV referenced this in commit 4dda051099 on Nov 3, 2014
  17. 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 18:15 UTC

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