Zero output not cleared #33265

issue jsarenik openend this issue on August 28, 2025
  1. jsarenik commented at 10:35 am on August 28, 2025: none

    I think this relates to #27463, fyi @instagibbs

    Working on a clear reproduction script for regtest, but here are some preliminary notes and signet examples:

    The script (network-less) is 51024e73. It decodes to different addresses for mainnet, testnets (including signets) and regtest:

    • bc1pfeessrawgf - mainnet
    • tb1pfees9rn5nz - testnets (incl. signets)
    • bcrt1pfeesnyr2tx - regtest

    This LN Anchor address is important because such transactions were noticed on signet. See examples of leftover outputs which were spent:

    These outputs can be seen as still available on current master (6ca6f3b37b99) on signet network. Just import following read-only descriptor wallet:

     0#!/bin/sh
     1### start a fresh signet daemon, moving old signet datadir
     2#bitcoin-cli -signet stop
     3#test -d ~/.bitcoin/signet-old || mv ~/.bitcoin/signet ~/.bitcoin/signet-old
     4#mkdir -p ~/bitcoin/signet/wallets
     5bitcoind -signet -daemon 2>/dev/null
     6
     7### adjust or enhance lines above and see also your bitcoin.conf
     8
     9until bitcoin-cli -signet echo hello 2>/dev/null | grep -q .
    10do
    11  sleep 1
    12done
    13
    14cd ~/.bitcoin/signet/wallets
    15test -d lnanchor && cd lnanchor || {
    16  bitcoin-cli -signet createwallet lnanchor true true
    17  bitcoin-cli -signet -rpcwallet=lnanchor \
    18   importdescriptors '[{"desc":"addr(tb1pfees9rn5nz)#8njps4hg","timestamp":"now"}]'
    19}
    20ph=$(bitcoin-cli -signet getblockchaininfo | grep pruneheight | tr -cd '[0-9]')
    21bitcoin-cli -signet loadwallet lnanchor
    22bitcoin-cli -signet -rpcwallet=lnanchor rescanblockchain $ph
    23
    24list() {
    25  bitcoin-cli -signet -rpcwallet=lnanchor \
    26    listunspent ${1:-0} \
    27    | grep -w -e txid -e vout -e amount -e confirmations -e safe \
    28    | tr -d ' ,"' \
    29    | cut -d: -f2 \
    30    | paste -d " " - - - - - \
    31    | sort -nk4
    32}
    33
    34while true; do LC_ALL=C date -u; list; sleep 1; done
    

    The script works both on an already-synced signet and a newly-syncing (uncomment lines in the top) one. Soon something like the following output may be seen and feel free to press ^C then:

     0...
     1Thu Aug 28 15:16:09 UTC 2025
     2a7b388a8f48350f92f8987d45409723bf329519816eba808de59ad6ebe974628 2 0.00000000 127 true
     3571be0fd823de6bd1c3bc9a7349297aacc7ce73bd99638b53e381aa1651f570c 2 0.00000000 128 true
     406df913b8fb0fc39dac875d1b5c4cc948499ed6e3dca6d2867afc59435e66a6f 2 0.00000000 129 true
     5e5cf85120935082b14889674d5c4ed66d8bfce3b8e9c0eebc9d4dea079de01d9 1 0.00000000 131 true
     66faa9ecf8b2c0afd657a32f50d5d93d91d33a578bd8fdd2ef4d960dea2a1bfb7 2 0.00000000 221 true
     785518747043d2bf36418f6262b6a8d35593bf8d2419250448f8cb5cbeab0d5d0 2 0.00000000 251 true
     824e532f648b951376f2cef53b8c07d1e0b1fd0652a257a62968988f31c4aca26 2 0.00000000 269 true
     9851248a635cb25d00dd39665636a3208c7252f059cfa418d43bf55535c283a5b 1 0.00000000 272 true
    10a69bdd445aa6f82798c745792268cad4cbb2c2dd2e7a32809ee94bce51c26de5 2 0.00000000 273 true
    1182779ab667f82ec42f4a7c561da5fab7952e32bf7215ba6d19a2e4fe22ab44a6 1 0.00000000 579 true
    12e67aebeb09f64b1fec0177bc1b1edf336f8a31df7f264a3d83db2c2b1ebd7bb7 2 0.00000000 602 true
    1367da00b7e55c249ed338618bf7caea128365c2a35c77da5abb379e8574e537a5 2 0.00000000 673 true
    146acce19b0418360f9e0c1650d2267fad6761dd0e98a2da23739b62ebfaa5cb00 2 0.00000000 675 true
    15ea0522ba8f4ada4d3770f0d81c212bb0f7da25235e2b8b57c04e90c96b5b598c 2 0.00000000 691 true
    16d24a3e60de8ccf95fc4dfa1d6efc9c5f77100d058d1fceccba40d6a54d1a02f2 1 0.00000000 738 true
    170378f0bc23d0cdbc7afe01dbfe77e4b925fa2c426a75509590ccd9f970ca288f 2 0.00000000 817 true
    1819b091d8653165fda6ac25f231b6afdaba3a35a4199fa39952ae63de16c08f04 2 0.00000000 818 true
    19bcb0311b7d3e78f636319ebb483e36cde5162545b7fc94df7cd4185112d7d712 2 0.00000000 832 true
    2013e541ef82d52ca1010b09990f28230cfd57ab54cccd7e7fbf427a05d66d515f 1 0.00000000 833 true
    2130f1fcc25b066c63f01b3b0588448bc285713d12c320d0505ac38a2aa96aaa8f 1 0.00000000 834 true
    

    Let’s take the first transaction (…4628) and its follow-up which spends the zero output. The latter can not be traced from the former on mempool.space other than checking the LN Anchor address.

    I would expect the zero output to be cleared in the descriptor wallet no matter if the spending transaction has anything to do with the first transaction in a package other than the zero output itself.

  2. maflcko added the label Wallet on Aug 28, 2025
  3. instagibbs commented at 1:14 pm on August 28, 2025: member
    thanks, hit me up when you reproduce it; I am having trouble disintangling if the issue is P2A, TRUC, ephemeral dust, or something else.
  4. jsarenik commented at 3:12 pm on August 28, 2025: none

    The linked transactions (…4628 and …34f5) in annotated raw:

     0VERSION: 03000000
     1FLAG: 0001
     2INPUTS: 01
     3 0c571f65a11a383eb53896d93be77cccaa979234a7c93b1cbde63d82fde01b57 01000000 00 00000000 #I-0
     4OUTPUTS: 03 [#0](/bitcoin-bitcoin/0/)..2
     5 e803000000000000 22 5120db7b995709b105a12719e1b4d92ab4bb616805fe0e2aee2db4b86efb64041b69 #O-0
     6 e803000000000000 22 512036a0c6a87cc73eab25ab672af73f4c766c38d3525844c2dca90f57c1308c39f3 #O-1
     7 0000000000000000 04 51024e73 #O-2
     8WITNESS:
     9 01 40 b0d664a1ab0e68ff57a35b2c23008f1bea28143d0be8caf048e69ff6fda633a16d65e2771c2988a3e2fb3ece118ecde205fea3d9f9d8f37e68da4cead332f348 #W-0
    10LOCKTIME: 00000000
    
     0VERSION: 03000000
     1FLAG: 0001
     2INPUTS: 02 [#0](/bitcoin-bitcoin/0/)..1
     3 284697be6ead59de08a8eb16985129f33b720954d487892ff95083f4a888b3a7 02000000 00 ffffffff #I-0
     4 f534e2d9bd6da6f42dc541c461ae75dbaaca3420c6afb9e7e7167189216e2492 00000000 00 fdffffff #I-1
     5OUTPUTS: 01
     6 ef04000000000000 22 51202924f1b0e89d6c495cc3334b06d38163e4e6f7fa9a5dc416a92953f6189854fe #O-0
     7WITNESS:
     8 00 #W-0
     9 01 40 47de320ab28aa6fbf0f3a96ae6b425f6b5f8addeb88dde3cd5e2d6a5d2bb58b9935265b34bd700438b2d1889e0d8b9d411f5898a7b1cdc9577da71f8f69bdcaf #W-1
    10LOCKTIME: c0120400
    

    The latter’s second input is the LittleEndian_txid of the former transaction.

    There just came a most-recent package on signet LN Anchor: first (zero-fee) and second (fee-paying spend)

    EDIT: the most-recent package (see above) seems to not case the same zero output leftover in the wallet. Let’s see the main difference:

    0VERSION: 03000000
    1FLAG: 0001
    2INPUTS: 01
    3 90c251d4a52f62f248511ab090632c0e017b3dab77462070956c6ca6d9dd3c99 00000000 00 00000000 #I-0
    4OUTPUTS: 02 [#0](/bitcoin-bitcoin/0/)..1
    5 a086010000000000 22 5120f9f8a765e492ce7341d639980a3e31e673cd2dee2166efebc8aa400852e1d923 #O-0
    6 0000000000000000 04 51024e73 #O-1
    7WITNESS:
    8 01 40 53debe230b68bc2b708f142fd420de1d4135e08b525ab0ca8e228eaafcf32c579d95dbc69721d918b57dcee4255766af8905fc66ca47902659fcf144f50e670d #W-0
    9LOCKTIME: 00000000
    
     0VERSION: 03000000
     1FLAG: 0001
     2INPUTS: 02 [#0](/bitcoin-bitcoin/0/)..1
     3 c6a6cd36f262677405c55302ceeb5a9a36412cb346bd3ffe31d1622e3f8594e1 01000000 00 ffffffff #I-0
     4 5bfda7cab1d363326218186f2d3e391ee1db14200d1b5564e748c52fe5fe3c99 01000000 00 fdffffff #I-1
     5OUTPUTS: 01
     6 8b85010000000000 22 5120f78d6ea4fd2f5f996867e97ab99c9ca552e3b67caa1e59da328a76f0f5a9bfc1 #O-0
     7WITNESS:
     8 00 #W-0
     9 01 40 f3f2fd33508fc137602da150a4cecf92f9acbb83d6737754abf1b93d26ecd537e41e1c6437766128be6fb585e6fb785ed1a0b7cf79293576ccd948e360694ef1 #W-1
    10LOCKTIME: 5b130400
    
  5. jsarenik commented at 5:03 pm on August 28, 2025: none

    From observation the important thing triggering the leftover (but spent, i.e. unusable) zero output inside a read-only descriptor wallet seem to be the two outputs to two different addresses in the final spend transaction. See https://mempool.space/signet/tx/af914f3f337bc84910d1d2d5d14556e5c2b07372ea99078d15c7a74c77c0b0e7?mode=details

    Also see https://signet257.bublina.eu.org/sffrest.txt which may contain such transactions in the end of its output:

    Ant the same snapshot in plain-text:

     0+ wc -l
     1+ safecat.sh /dev/shm/sffrest.txt
     2+ ls -1 /tmp/sffrest/
     3+ wc -l
     4+ myrest=2
     5+ ls -1 /tmp/sff-s3/
     6+ wc -l
     7+ myst=19
     8+ echo rest 2 stage3 19
     9rest 2 stage3 19
    10+ echo finn
    11finn
    12+ rmdir /tmp/locksff
    13+ exit 0
    14Thu Aug 28 16:51:27 UTC 2025
    1524K	/dev/shm/wallets-signet/lnanchor
    161.6M	/dev/shm/wallets-signet/newmy5909
    1724K	/dev/shm/wallets-signet/optrue
    18Bitcoin Core daemon version v29.99.0-56f7433ded8d
    19
    20All current LN Anchor outputs seen by this node:
    21# txid vout amt conf safe
    2296599c7733f2ac4464707c43b1a9ec3dfccbfbb34a6bc7ff25cde695de43670c 2 0.00000000 7 true
    23af914f3f337bc84910d1d2d5d14556e5c2b07372ea99078d15c7a74c77c0b0e7 2 0.00000000 8 true
    24e194853f2e62d131fe3fbd46b32c41369a5aebce0253c505746762f236cda6c6 1 0.00000000 9 true
    
  6. achow101 commented at 8:29 pm on August 28, 2025: member
    This seems like it’s because the check for whether a transaction is “from” the wallet is if it a non-zero amount leaves the wallet. Since these outputs are 0 value, they are definitionally do not meet that criteria.

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: 2025-09-01 15:12 UTC

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