There is a lot here, but I just wanted to get this put out so others can take a look. These are notes I made from COINBASE_MATURITY related things that I found, and think need to be looked at and probably fixed, in the tests. In some places, I was not sure what the code was doing, so I mention that, but I think that code needs to be reviewed.
Three different variables are used throughout the tests:
- COINBASE_MATURITY = 8 from test_framework/blocktools.py
- COINBASE_MATURITY_ORIGINAL = 100 from test_framework/blocktools.py
- COINBASE_MATURITY_2 = 100 from consensus/consensus.h
Files to be reviewd:
test/functional/test_framework/blocktools.py
- COINBASE_MATURITY and COINBASE_MATURITY_ORIGINAL below are used in a lot of the tests. These are their values.
- Line 62: COINBASE_MATURITY = 8
- Line 63: COINBASE_MATURITY_ORIGINAL = 100
test/functional/feature_assumevalid.py
- At about line 35, should it import COINBASE_MATURITY_ORIGINAL rather than setting it at line 56?
- The use of COINBASE_MATURITY_ORIGINAL in the rest of the file makes sense.
test/functional/feature_backwards_compatibility.py
- Line 24 imports COINBASE_MATURITY (value of 8), probably should import COINBASE_MATURITY_ORIGINAL (100)?
- Line 67, blocks are generated, but not enough to have 100 confirmations
- Line 91, tried to send 10 DGB, but coinbase maturity of 100 was never reached, so it is not spendable
test/functional/feature_coinstatsindex.py
- Appears to correctly use COINBASE_MATURITY_ORIGINAL on lines 16 and 72
test/functional/feature_loadblock.py
- Appears to correctly use COINBASE_MATURITY_ORIGINAL on lines 19 and 32
test/functional/feature_nulldummy.py
- This uses COINBASE_MATURITY from test_framework.blocktools
- COINBASE_MATURITY in test_framework.blocktools is set to 8
- The comment on line 9 says the coinbases should be mature. Because of this, should it not use COINBASE_MATURITY_ORIGINAL?
- COINBASE_MATURITY would then need to be changed to COINBASE_MATURITY_ORIGINAL on lines 9, 18, 53, 79, 81, 84, 98, and 115
test/functional/feature_rbf.py
- Lines 10 and 56 should use COINBASE_MATURITY_ORIGINAL so all txs spend confirmed coins
test/functional/feature_taproot.py
- I'm not clear on it lines 9 and 1465 should be using COINBASE_MATURITY_ORIGINAL instead of COINBASE_MATURITY
test/functional/interface_digibyte_cli.py
- On line 22, block reward stated as being 72000. Is that correct? 72000 is used on line 26.
- Should lines 11, 23, 24, 25, and 26 be COINBASE_MATURITY_ORIGINAL instead of COINBASE_MATURITY?
- Shouldn't the comment on line 23 state "after mining 100+1 blocks"?
test/functional/mempool_compatibility.py
- Should lines 15 and 45 use COINBASE_MATURITY_ORIGINAL?
test/functional/mempool_expiry.py
- Lines 15 and 40 should use COINBASE_MATURITY_ORIGINAL so all txs can spend confirmed coins
test/functional/mempool_limit.py
- Line 9 imports COINBASE_MATURITY. Shouldn't it import COINBASE_MATURITY_ORIGINAL?
- Shouldn't line 61 use COINBASE_MATURITY_ORIGINAL so it uses a value of 100?
test/functional/mempool_package_onemore.py
- Lines 13 and 34 need to use COINBASE_MATURITY_ORIGINAL so they will mature
test/functional/mempool_packages.py
- Appears to correctly use COINBASE_MATURITY_ORIGINAL on lines 10 and 50
test/functional/mempool_reorg.py
- Should lines 14 and 106 be COINBASE_MATURITY or COINBASE_MATURITY_ORIGINAL
- Why does line 35/36 say block 76 is the first spendable coinbase tx?
test/functional/mempool_resurrect.py
- Lines 7 and 24 should use COINBASE_MATURITY_ORIGINAL instead of COINBASE_MATURITY since it spends coins on line 93.
test/functional/mempool_spend_coinbase.py
- Lines 17, 33, 36, and 38 should use COINBASE_MATURITY_ORIGINAL instead of COINBASE_MATURITY. The math on lines 36 and 38 should take 198-100+1 and 198-100+2, but COINBASE_MATURITY = 8, not 100.
test/functional/mining_getblocktemplate_longpoll.py
- Lines 11 and 66 should use COINBASE_MATURITY_ORIGINAL so all txs spend confirmed coins
- Some blocks have previously been generated, so on line 66, a "+1" do not need to be added to COINBASE_MATURITY_ORIGINAL
test/functional/p2p_blocksonly.py
- Line 9 imports COINBASE_MATURITY (value of 8)
- Comment on line 25 says "Add enough mature utxos to the wallet, so that all txs spend confirmed coins"
- Line 27 only generates 8, but aren't 100 needed?
test/functional/p2p_compactblocks.py
- Not sure if coins need to be matured or not.
- If they need to be matured, should lines 13, 168, 279, and 297 use COINBASE_MATURITY_ORIGINAL?
test/functional/p2p_dandelion.py
- Lines 31 and 87 should use COINBASE_MATURITY_ORIGINAL instead of COINBASE_MATURITY since it spends coins on line 102.
test/functional/p2p_eviction.py
- Line 19, import COINBASE_MATURITY_ORIGINAL instead of COINBASE_MATURITY?
- Line 56, use COINBASE_MATURITY_ORIGINAL?
test/functional/p2p_feefilter.py
- Line 9 imports COINBASE_MATURITY (value of 8)
- Comment on line 83 says "Add enough mature utxos to the wallet, so that all txs spend confirmed coins"
- Line 85 only generates 8, but aren't 100 needed?
test/functional/p2p_leak_tx.py
- Line 7 imports COINBASE_MATURITY. Shouldn't it import COINBASE_MATURITY_ORIGINAL?
- Shouldn't line 31 use COINBASE_MATURITY_ORIGINAL so it uses a value of 100?
test/functional/rpc_createmultisig.py
- Line 131, shouldn't this be COINBASE_MATURITY_ORIGINAL?
test/functional/rpc_dumptxoutset.py
- Appears to correctly be using COINBASE_MATURITY_ORIGINAL on lines 10 and 29.
test/functional/rpc_getblockstats.py
- Appears to correctly use COINBASE_MATURITY_ORIGINAL on lines 13 and 54
test/functional/rpc_net.py
- Lines 15 and 58 should use COINBASE_MATURITY_ORIGINAL so all txs spend confirmed coins
test/functional/rpc_rawtransaction.py
- Need mature coins to spend on line 80, so use COINBASE_MATURITY_ORIGINAL instead of COINBASE_MATURITY on lines 18 and 78
test/functional/rpc_signrawtransaction.py
- Should lines 8, 184, and 203 use COINBASE_MATURITY_ORIGINAL instead of COINBASE_MATURITY so there is a matured coinbase tx?
test/functional/rpc_txoutproof.py
- Lines 7, 33, and 36 should use COINBASE_MATURITY_ORIGINAL instead of COINBASE_MATURITY so txs can spend confirmed coins
test/functional/wallet_abandonconflict.py
- Lines 15 and 32 should use COINBASE_MATURITY_ORIGINAL instead of COINBASE_MATURITY since it spends coins on line 34.
test/functional/wallet_address_types.py
- Import on line 56 could be deleted. The rest of the code uses COINBASE_MATURITY_ORIGINAL
test/functional/wallet_backup.py
- Comment on line 157 says to "Generate 101 more blocks"
- Lines 39, 129, and 158 should use COINBASE_MATURITY_ORIGINAL instead of COINBASE_MATURITY
- Part of the comments on lines 168 and 169 are incorrect. Shouldn't there be 114 mature blocks?
test/functional/wallet_balance.py
- On line 103, it looks like it is sending coins. If that is the case, shouldn't lines 11, 76, and 160 use COINBASE_MATURITY_ORIGINAL?
test/functional/wallet_basic.py
- The comment on line 58 says "DigiByte specific: COINBASE_MATURITY is set to 8 instead of 100 (in BTC)."
- In this test, does a coinbase tx really mature after only 8 blocks? See comment on line 188.
- Should lines 11, 98, and 189 be COINBASE_MATURITY_ORIGINAL instead of COINBASE_MATURITY?
test/functional/wallet_bumpfee.py
- Line 20 imports COINBASE_MATURITY (value of 8)
- Line 78: should it use COINBASE_MATURITY_2 so there are 10 confirmed blocks? Maybe I am not understanding what this is doing.
test/functional/wallet_coinbase_category.py
- Lines 10 and 45 needs to use COINBASE_MATURITY_ORIGINAL
- Comments on lines 44 and 46 need to be updated to reflect correct number of blocks for maturity
test/functional/wallet_descriptor.py
- Lines 8 and 88 should use COINBASE_MATURITY_ORIGINAL instead of COINBASE_MATURITY since it spends coins on line 93.
test/functional/wallet_fallbackfee.py
- Lines 7 and 20 should use COINBASE_MATURITY_ORIGINAL instead of COINBASE_MATURITY since it spends coins on line 23.
test/functional/wallet_groups.py
- Lines 7 and 37 should use COINBASE_MATURITY_ORIGINAL so all txs spend confirmed coins
test/functional/wallet_hd.py
- Lines 10 and 52 should use COINBASE_MATURITY_ORIGINAL instead of COINBASE_MATURITY since it spends coins on line 65.
test/functional/wallet_importdescriptors.py
- Line 19 imports COINBASE_MATURITY (value of 8)
- Not sure if this needs a mature utxo or not, but it is only creating 9 blocks
test/functional/wallet_importmulti.py
- Lines 258, 278, 298, 323
○ Should they use COINBASE_MATURITY_ORIGINAL?
○ Should they actually use "COINBASE_MATURITY_ORIGINAL + 1" since the next line tries to spend 10?
test/functional/wallet_importprunedfunds.py
- Lines 8, 28, and 48 should use COINBASE_MATURITY_ORIGINAL instead of COINBASE_MATURITY since it spends coins on line 64.
test/functional/wallet_keypool_topup.py
- If there needs to be a mature block, shouldn't it use COINBASE_MATURITY_ORIGINAL instead of COINBASE_MATURITY on lines 16 and 35?
test/functional/wallet_labels.py
- Don't know if this needs 8+1 blocks or 100+1 blocks when it generates blocks.
test/functional/wallet_listsinceblock.py
- Line 45 needs mature coins to spend, so use COINBASE_MATURITY_ORIGINAL instead of COINBASE_MATURITY on lines 8 and 33
test/functional/wallet_multiwallet.py
- Not sure what this is doing. Does it need confirmed blocks? If so, lines 17 and 233 should use COINBASE_MATURITY_ORIGINAL
test/functional/wallet_orphanedreward.py
- Having a little difficulty following this, but is the purpose of line 22 to generate a bunch of blocks so that some are spendable? If so, shouldn't it use COINBASE_MATURITY_ORIGINAL so it generates 150 blocks instead of just 58 blocks?
- Same thing for lines 33 and 40
test/functional/wallet_taproot.py
- Line 9 imports COINBASE_MATURITY (value of 8)
- Don't understand exactly what's happening here, so not sure if 8+1 or 100+1 blocks are needed
test/functional/wallet_txn_clone.py
- Comments on lines 54, 109, and 151 refer to COINBASE_MATURITY being 8 for DigiByte. Should it be referring to COINBASE_MATURITY_ORIGINAL (100)?
test/functional/wallet_txn_doublespend.py
- Not sure what is happening here, but two comments reference "In DigiByte, since COINBASE_MATURITY is only set to 8", so is something in here expecting coins to be matured after 8 blocks?
test/functional/wallet_upgradewallet.py
- Not sure if this needs confirmed coins or not, but if it does, lines 19, 122, 125, 133 need to use COINBASE_MATURITY_ORIGINAL
test/functional/wallet_watchonly.py
- Line 8, import COINBASE_MATURITY_ORIGINAL instead of COINBASE_MATURITY?
- Line 40, use COINBASE_MATURITY_ORIGINAL
src/test/fuzz/process_message.cpp
- I am not clear on if this should be using COINBASE_MATURITY or COINBASE_MATURITY_2 on line 61
src/test/fuzz/process_messages.cpp
- Already uses COINBASE_MATURITY_2
src/test/fuzz/tx_pool.cpp
- Lines 37 and 40 appear to be correctly using COINBASE_MATURITY_2
- Not exactly sure what line 132 is calculating. Should it use COINBASE_MATURITY_2 instead of COINBASE_MATURITY? What is the value 50?
src/test/fuzz/utxo_snapshot.cpp
- Already uses COINBASE_MATURITY_2
src/test/util/setup_common.cpp
- This correctly uses COINBASE_MATURITY_2 from consensus/consensus.h
src/test/validation_block_tests.cpp
- Already using COINBASE_MATURITY_2
src/wallet/test/wallet_tests.cpp
- I'm not exactly sure what this is doing.
- This uses both COINBASE_MATURITY and COINBASE_MATURITY_2, so the code might be good