Unique coinbase: Fixes #482 #505

pull gavinandresen wants to merge 7 commits into bitcoin:master from gavinandresen:unique_coinbase changing 3 files +14 −15
  1. gavinandresen commented at 3:05 PM on September 7, 2011: contributor

    Fix from luke-jr, I reviewed the code but have not tested.

    Rough sketch of a test plan:

    • Run clean testnet-in-a-box bitcoind, with -keypool=1
    • Encrypt the wallet
    • Run bitcoind getnewaddress until it tell you keypool is exhausted
    • Generate a couple of blocks via internal miner -- verify: coinbase transactions have unique txids even though they pay-to default key
    • Generate a couple of blocks via getwork RPC call -- verify: coinbase transactions have unique txids
  2. Update nTime after nExtraNonce to avoid potential race
    (extraNonce being reset due to just-occurred time change after nTime is set)
    3a8029f033
  3. Reset extraNonce only every 15 seconds, just in case some miner is updating time himself and stuff aa4a9c5250
  4. Reset extraNonce only when prevBlock changes, so miners can continue updating the time on their work until it's stale 02d87b3aa3
  5. Merge branch 'getwork_dedupe' into unique_coinbase b760e25458
  6. Save coinbase, not just extraNonce 49c8e53ee2
  7. Bugfix: Use timestamp in coinbase rather than "bits", needed to ensure coinbase txn is unique even if address is the same 83f4cd156e
  8. Merge branch 'unique_coinbase' of git://gitorious.org/~Luke-Jr/bitcoin/luke-jr-bitcoin into unique_coinbase 5a3dea451d
  9. TheBlueMatt commented at 3:18 PM on September 7, 2011: member

    First of all, can we get commitmsgs that are readable?

  10. alexwaters commented at 7:50 PM on September 7, 2011: contributor

    Ok I did the steps above in a fresh build of 0.4.0rc1 with the testnet-in-a-box files, and landed at code:-12 error: Keypool ran out, please call keypoolrefill first

    I then restarted my daemons with the -gen tag. Up to about 20 generated blocks now.

    My Ubuntu skills are lacking, the txids look unique to me; but obviously that's not good enough. Any help with http://bitcoin.stackexchange.com/questions/706/how-do-i-sort-the-output-of-listtransactions would be appreciated.

    Lastly, I'm not familiar with RPC - is there any resource for how I would do a getwork call wtih RPC?

  11. gavinandresen commented at 11:12 PM on September 7, 2011: contributor

    getwork is how external miners ask for block headers to work on, so to test it you'd fire up a miner and tell it to ask for work from your bitcoind.

    There's an external python-based miner in the config/pyminer/ directory (named pyminer.py) that aught to be handy for testing (it is very slow, though). If you're running testnet-in-a-box, note that you'll need to be running two bitcoinds talking to each other for any mining to get done.

    I just tried:

    pyminer.py bcc1.cfg

    ... and got: 2 mining threads started Wed Sep 7 19:08:12 2011 Miner Starts - 127.0.0.1:9000 HashMeter(0): 1000000 hashes, 249.67 Khash/sec HashMeter(1): 1000000 hashes, 255.08 Khash/sec

    where bcc1.cfg contains settings that match my weird testnet-in-a-box setup (running with rpcport=9000):

    host=127.0.0.1 port=9000 rpcuser=abc rpcpass=123 threads=2 scantime=60 hashmeter=1

  12. sipa commented at 1:22 PM on September 8, 2011: member

    The commits are a bit messy - lots of changes that are not used in later commits. ACK on the actual code change though (though it needs testing).

  13. alexwaters commented at 1:17 PM on September 9, 2011: contributor

    Tested, no duplicate txids.

  14. gavinandresen referenced this in commit b7598ceefa on Sep 9, 2011
  15. gavinandresen merged this on Sep 9, 2011
  16. gavinandresen closed this on Sep 9, 2011

  17. coblee referenced this in commit 92e857f47b on Jul 17, 2012
  18. zathras-crypto referenced this in commit 724e99034d on Nov 29, 2017
  19. kallewoof referenced this in commit 658dae0bba on Oct 4, 2019
  20. rajarshimaitra referenced this in commit ff8a7acee2 on Aug 5, 2021
  21. DrahtBot locked this on Sep 8, 2021
  22. DrahtBot added the label CI failed on Apr 11, 2023
  23. MarcoFalke removed the label CI failed on Apr 11, 2023

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-22 06:16 UTC

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