never mind - solved! #10003

issue pinheadmz opened this issue on March 15, 2017
  1. pinheadmz commented at 7:12 PM on March 15, 2017: member

    never mind - solved!

  2. pinheadmz renamed this:
    Coins missing (not added to wallet) after max chain of unconfirmed spends
    Coins missing (not added to wallet) after max chain of unconfirmed spends + other weirdness
    on Mar 15, 2017
  3. pinheadmz renamed this:
    Coins missing (not added to wallet) after max chain of unconfirmed spends + other weirdness
    never mind - solved!
    on Mar 15, 2017
  4. pinheadmz closed this on Mar 15, 2017

  5. MarcoFalke commented at 7:24 PM on March 15, 2017: member

    @pinheadmz No need to delete the contents when closing the issue. Also, it might help others if you included the solution to the issue.

    On Wed, Mar 15, 2017 at 8:12 PM, Matthew Zipkin notifications@github.com wrote:

    Generate transactions spending unconfirmed change until the maximum unconfirmed chain size is hit.

    See: https://github.com/bitcoin/bitcoin/blob/57b34599b2deb179ff1bd97ffeab91ec9f904d85/doc/release-notes/release-notes-0.12.0.md

    "Bitcoin Core 0.12 also introduces new default policy limits on the length and size of unconfirmed transaction chains that are allowed in the mempool (generally limiting the length of unconfirmed chains to 25 transactions, with a total size of 101 KB)."

    Change output of last transaction in chain does not appear in wallet balance until bitcoind is restarted with -rescan, and even then balance seems incorrect?

    Demonstration:

    Generate 101 blocks so only one 50 BTC subsidy is mature to spend:

    $ ./bitcoin-cli -regtest generate 101 [ "4a7ace38144a1aa3f6429cd44689eab15848bf5153020e28f774dd06bd953662", ... ... ... "441712a7e648bb65ba08c36288390d70bd418509cbc5ecacaa84d07acf024fc6" ] $ ./bitcoin-cli -regtest getinfo { "version": 140000, "protocolversion": 70015, "walletversion": 130000, "balance": 50.00000000, ... ... ...

    Now attempt to generate 30 x 0.5 BTC transactions from this one output, forcing bitcoind to spend unconfirmed change outputs in a chain until the maximum is hit -- which is indicated by "Insufficient funds":

    $ for n in {1..30}; do ./bitcoin-cli -regtest sendtoaddress 2NCY1Q1Mu6V5uha7fDzGNYYPUs5F1zSdXCL 0.5; done f920747b040c9cbaed03e616699af2cdfb17c01ea8781aa63cc50a2a41eeabf0 0dc4e1576673e41c49f9fc6440b2f8d500488164698c5b22251b422e9541dbb7 8a155048ea29e0b16ea16697a688b02009cc16ab389eb8e19b51c7ec8660e6b6 c97c1188a7c3233c45af8e32174328bb8ad66ef4a54ef8213b4966434eb4bc15 b83856c1a9d3c0c3ab4af392c88168824081b3169f81a1017bd8813a235bf039 8721cd61e172671b1ed3e1dcf302d9438c033fb8a5c12497ee937322bfa245d9 1cc84a266f8f7c25f4ee2447e67c2f75a8674dc85d51c22d3422d5b4ed3945b4 dcdbf7bfa241f2bbf3b16877950494eff6ee1e1764284a3ec43c82964b513f70 88ef788333ed83161ea8059316d91ee2980ad39177d75906c688c3dab440d762 f6989e54a4cf628763c339c32476b4424e748055f5f15097936706827f13f4c0 35761b5751bf8de18c38bd695e945a1f3318c9161bbb5d56fb3719839143c2cf 24c5a21aac7da653fa34380639bec49cfb1b84aa82b00453244acbc91a41a984 07ef6b7a932663872657e1bc2a15540279f1bbebbbd97d0bd57a0d1f8dce4810 babcaef4a4946d341e96da813430ef05c33619a37af6e0f89ad6892ffe4d8959 66f35a0f8d8fd9c57d4cd0af10034aa13fb295ca8ac98da615ae4670338ecdbc ceb6f86970586a116ab652d8b74accdbc148f98d1be5ab0fc89bfbcdb84d43c4 88df670d619d77a41d901d98125d5156b57a656e9da2447c0e6817b5a826b737 235b8c35837a67a44147fbfc90f52c271705efa05f35f25194943711810c40c8 3a76e4b99effc8edda75e86a35dc25445ad58871a5376af68d0d7915fec9c96a 1ab0458f06b20968cdad7ec102481fe524b4533664a1a15f241458bf1e65d4ec 8e14ec9f71837fe353ab3dff864131b37df7af14ca0789c504077789422e787e d3913e9b617d3b9584415a8f03945699b01fc8e9c589226deabcaccf835d4ec4 c4cfd682bc1534b69f019aa7b93d6a1b324f8f62c8485736f3336bc5b8c9668f 97e27736c144436a8e01b06ec3e290d6a49f0708c69afa23beeeb34b80cd3ee7 c8337941c8688f26da567d1f34702cc89d33ce1f1e11cfdb98e47857bc0ccad4 ec7413149a996a0e0869b6db2c739e7d189ebf9c216ea5af5e81e771f9ce21e4 error code: -6 error message: Insufficient funds error code: -6 error message: Insufficient funds error code: -6 error message: Insufficient funds error code: -6 error message: Insufficient funds

    So apparently 26 transactions were generated. There should still be some change left in my wallet. But...

    $ ./bitcoin-cli -regtest listunspent [ ] $ ./bitcoin-cli -regtest getinfo { "version": 140000, "protocolversion": 70015, "walletversion": 130000, "balance": 0.00000000, ... ... ...

    Ok that's weird. Let's see what's up with that very last tx that was generated (tx 26)

    $ ./bitcoin-cli -regtest getrawtransaction ec7413149a996a0e0869b6db2c739e7d189ebf9c216ea5af5e81e771f9ce21e4 1 error code: -5 error message: No such mempool transaction. Use -txindex to enable blockchain transaction queries. Use gettransaction for wallet transactions.

    This is already unexpected behavior - what happened to transaction 26? Ok let's try tx 25, the penultimate tx we generated:

    $ ./bitcoin-cli -regtest getrawtransaction c8337941c8688f26da567d1f34702cc89d33ce1f1e11cfdb98e47857bc0ccad4 1 { "hex": "0200000001e73ecd804bb3eebe23fa9ac608079fa4d690e2c36eb0018e6a4344c13677e297010000006b483045022100d5c4fc0d2a65e2b2465b486f33411b7896fe1a0da7e7975bcfa9f0c13e215fdd0220154afe927e19e3ba19797013d0072441d27a4cd3bc0eb340bf3afe848fe071ca012102183d0fd8535e1b0102b2b538b3e89df7fcaf99c9c213791b62df3fb7d04b23acfeffffff0280f0fa020000000017a914d396f368f3b4348ced0ed1f4138bb2906e12f7df87a8c282df000000001976a9143439f1a39955abc35bf688c57ba50ec7a4fabc8288ac65000000", "txid": "c8337941c8688f26da567d1f34702cc89d33ce1f1e11cfdb98e47857bc0ccad4", "hash": "c8337941c8688f26da567d1f34702cc89d33ce1f1e11cfdb98e47857bc0ccad4", "size": 224, "vsize": 224, "version": 2, "locktime": 101, "vin": [ { "txid": "97e27736c144436a8e01b06ec3e290d6a49f0708c69afa23beeeb34b80cd3ee7", "vout": 1, "scriptSig": { "asm": "3045022100d5c4fc0d2a65e2b2465b486f33411b7896fe1a0da7e7975bcfa9f0c13e215fdd0220154afe927e19e3ba19797013d0072441d27a4cd3bc0eb340bf3afe848fe071ca[ALL] 02183d0fd8535e1b0102b2b538b3e89df7fcaf99c9c213791b62df3fb7d04b23ac", "hex": "483045022100d5c4fc0d2a65e2b2465b486f33411b7896fe1a0da7e7975bcfa9f0c13e215fdd0220154afe927e19e3ba19797013d0072441d27a4cd3bc0eb340bf3afe848fe071ca012102183d0fd8535e1b0102b2b538b3e89df7fcaf99c9c213791b62df3fb7d04b23ac" }, "sequence": 4294967294 } ], "vout": [ { "value": 0.50000000, "n": 0, "scriptPubKey": { "asm": "OP_HASH160 d396f368f3b4348ced0ed1f4138bb2906e12f7df OP_EQUAL", "hex": "a914d396f368f3b4348ced0ed1f4138bb2906e12f7df87", "reqSigs": 1, "type": "scripthash", "addresses": [ "2NCY1Q1Mu6V5uha7fDzGNYYPUs5F1zSdXCL" ] } }, { "value": 37.49888680, "n": 1, "scriptPubKey": { "asm": "OP_DUP OP_HASH160 3439f1a39955abc35bf688c57ba50ec7a4fabc82 OP_EQUALVERIFY OP_CHECKSIG", "hex": "76a9143439f1a39955abc35bf688c57ba50ec7a4fabc8288ac", "reqSigs": 1, "type": "pubkeyhash", "addresses": [ "mkH6r3PzZy8atSaYbVsxK6GqkHACxuU1X9" ] } } ] }

    Ok, so there's my last valid output, worth 37.49888680. Let's mine a block with all those transactions, note how my new balance is still just 50 BTC, from that second block maturing:

    $ ./bitcoin-cli -regtest generate 1 [ "3424e6fe7a07954a322eac83d09b429ca4eb4ff4068c98071512ea0fff42b59a" ] $ ./bitcoin-cli -regtest getinfo { "version": 140000, "protocolversion": 70015, "walletversion": 130000, "balance": 50.00000000, ... ... ...

    Also note that transaction 26 DID NOT make it into the block:

    $ ./bitcoin-cli -regtest getblock 3424e6fe7a07954a322eac83d09b429ca4eb4ff4068c98071512ea0fff42b59a { ... ... ... "tx": [ "a66dd96e95107bf14d809690729c0257aacaefcdf336a57b3b6bd261f79c85ef", "f920747b040c9cbaed03e616699af2cdfb17c01ea8781aa63cc50a2a41eeabf0", "0dc4e1576673e41c49f9fc6440b2f8d500488164698c5b22251b422e9541dbb7", "8a155048ea29e0b16ea16697a688b02009cc16ab389eb8e19b51c7ec8660e6b6", "c97c1188a7c3233c45af8e32174328bb8ad66ef4a54ef8213b4966434eb4bc15", "b83856c1a9d3c0c3ab4af392c88168824081b3169f81a1017bd8813a235bf039", "8721cd61e172671b1ed3e1dcf302d9438c033fb8a5c12497ee937322bfa245d9", "1cc84a266f8f7c25f4ee2447e67c2f75a8674dc85d51c22d3422d5b4ed3945b4", "dcdbf7bfa241f2bbf3b16877950494eff6ee1e1764284a3ec43c82964b513f70", "88ef788333ed83161ea8059316d91ee2980ad39177d75906c688c3dab440d762", "f6989e54a4cf628763c339c32476b4424e748055f5f15097936706827f13f4c0", "35761b5751bf8de18c38bd695e945a1f3318c9161bbb5d56fb3719839143c2cf", "24c5a21aac7da653fa34380639bec49cfb1b84aa82b00453244acbc91a41a984", "07ef6b7a932663872657e1bc2a15540279f1bbebbbd97d0bd57a0d1f8dce4810", "babcaef4a4946d341e96da813430ef05c33619a37af6e0f89ad6892ffe4d8959", "66f35a0f8d8fd9c57d4cd0af10034aa13fb295ca8ac98da615ae4670338ecdbc", "ceb6f86970586a116ab652d8b74accdbc148f98d1be5ab0fc89bfbcdb84d43c4", "88df670d619d77a41d901d98125d5156b57a656e9da2447c0e6817b5a826b737", "235b8c35837a67a44147fbfc90f52c271705efa05f35f25194943711810c40c8", "3a76e4b99effc8edda75e86a35dc25445ad58871a5376af68d0d7915fec9c96a", "1ab0458f06b20968cdad7ec102481fe524b4533664a1a15f241458bf1e65d4ec", "8e14ec9f71837fe353ab3dff864131b37df7af14ca0789c504077789422e787e", "d3913e9b617d3b9584415a8f03945699b01fc8e9c589226deabcaccf835d4ec4", "c4cfd682bc1534b69f019aa7b93d6a1b324f8f62c8485736f3336bc5b8c9668f", "97e27736c144436a8e01b06ec3e290d6a49f0708c69afa23beeeb34b80cd3ee7", "c8337941c8688f26da567d1f34702cc89d33ce1f1e11cfdb98e47857bc0ccad4" ], ... ... ...

    Now restart bitcoind with -rescan to pick up that missing change output:

    $ ./bitcoind -daemon -regtest -rescan Bitcoin server starting $ ./bitcoin-cli -regtest listunspent [ { "txid": "99d10bd2e5b31c7112b981e6fa5d4dd879ac9e46cabc3ecf0eb1b52376e98e0e", "vout": 0, "address": "mvtjzs8G7F2HkPfMKfEowhdyKq2rvKjnFy", "scriptPubKey": "2102bc847fcca9f32804a1127e20627516da2db3a93803bfedfd5d98b9e9c1a1c1bbac", "amount": 50.00000000, "confirmations": 101, "spendable": true, "solvable": true } ] $ ./bitcoin-cli -regtest getinfo { "version": 140000, "protocolversion": 70015, "walletversion": 130000, "balance": 86.99884200, ... ... ...

    Multiple unexpected results here: First, the balance is wrong - remember how the last tx change output that I generated was worth 37.49888680? Shouldn't my balance be 87.49888680 then? It's almost like that missing transaction 26 DID work, but it's not in the block...?! And why is there only one output listed by listunspent? It literally does not add up!

    — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

  6. 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-29 03:15 UTC

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