Assertion failed in CWallet::CreateTransactionInternal during sendmany #23353

issue lukaszsamson openend this issue on October 25, 2021
  1. lukaszsamson commented at 2:45 pm on October 25, 2021: none

    Since few days my mainnet node is crashing when sending a transaction(s).

    Expected behavior

    No crash

    Actual behavior when calling sendmany via JSON RPC with params: ["", {(redacted): (redacted)}, null, null, null, true]

    0Oct 25 10:48:16 myhost.local bitcoind[11906]: bitcoind: wallet/spend.cpp:783: bool CWallet::CreateTransactionInternal(const std::vector<CRecipient>&, CTransactionRef&, CAmount&, int&, bilingual_str&, const CCoinControl&, 
    1FeeCalculation&, bool): Assertion `coin_selection_params.m_subtract_fee_outputs || fee_needed <= change_and_fee - change_amount' failed.
    2Oct 25 10:48:16 myhost.local systemd[1]: bitcoind.service: main process exited, code=killed, status=6/ABRT
    3Oct 25 10:48:16 myhost.local.local systemd[1]: Unit bitcoind.service entered failed state.
    4Oct 25 10:48:16 myhost.local.local systemd[1]: bitcoind.service failed.
    

    To reproduce

    Not sure

    System information

    22.0 official build (https://bitcoincore.org/bin/bitcoin-core-22.0/bitcoin-22.0-x86_64-linux-gnu.tar.gz)

    Linux centos 7, x64, AWS EBS

    debug.log just before the crash

    02021-10-25T10:44:48Z UpdateTip: new best=0000000000000000000843e96d7018b2d4ff86b1d43c6b83bcd3b80a804ff666 height=706607 version=0x20002004 log2_work=93.137445 tx=681104170 date='2021-10-25T10:44:30Z' progress=1.000000 cache=56.5MiB(
    1432091txo)
    22021-10-25T10:45:53Z UpdateTip: new best=00000000000000000006ca3ee822d8ca2a74022721d37f04ffaf5c218b14625c height=706608 version=0x20000004 log2_work=93.137457 tx=681105856 date='2021-10-25T10:45:34Z' progress=1.000000 cache=56.7MiB(
    3433916txo)
    42021-10-25T10:46:18Z UpdateTip: new best=00000000000000000001c9f7f7a1f1862d78ed6a25686c7c06fcd3d322fac84c height=706609 version=0x20c00004 log2_work=93.137468 tx=681107058 date='2021-10-25T10:45:54Z' progress=1.000000 cache=56.7MiB(
    5433677txo)
    62021-10-25T10:46:18Z BlockUntilSyncedToCurrentChain: txindex is catching up on block notifications
    72021-10-25T10:46:18Z [default wallet] AddToWallet(TX redacted)  update
    82021-10-25T10:48:15Z [default wallet] keypool added 1 keys (1 internal), size=2000 (1000 internal)
    92021-10-25T10:48:15Z [default wallet] keypool reserve 51379
    

    in other cases there was no line with AddToWallet(TX redacted) update

    wallet info

     0bicoin-cli getwalletinfo
     1{
     2  "walletname": "",
     3  "walletversion": 159900,
     4  "format": "bdb",
     5  "balance": (redacted),
     6  "unconfirmed_balance": 0.00000000,
     7  "immature_balance": 0.00000000,
     8  "txcount": (redacted),
     9  "keypoololdest": (redacted),
    10  "keypoolsize": 1000,
    11  "hdseedid": (redacted),
    12  "keypoolsize_hd_internal": 999,
    13  "unlocked_until": 0,
    14  "paytxfee": 0.00001000,
    15  "private_keys_enabled": true,
    16  "avoid_reuse": false,
    17  "scanning": false,
    18  "descriptors": false
    19}
    

    When retried after restart the same transaction is submitted with no problems.

  2. lukaszsamson added the label Bug on Oct 25, 2021
  3. MarcoFalke added the label Wallet on Oct 25, 2021
  4. MarcoFalke added this to the milestone 22.1 on Oct 25, 2021
  5. lukaszsamson commented at 2:53 pm on October 25, 2021: none
  6. achow101 commented at 4:06 pm on October 25, 2021: member
    Looks like this is related to #22949
  7. lukaszsamson commented at 4:50 pm on October 25, 2021: none

    You may be right @achow101

    It is unlikely that a user can trigger this as it requires a very specific set of rounding errors to occur as well as the transaction not needing any change and being right on the lower bound of the exact match window. However I was able to trigger the assertion while running coin selection simulations, albeit after thousands of transactions and with some weird feerates.

    In all of the cases the transactions that were successfully resubmitted had exactly 0 change outputs (I can say that especially about the one case that resulted in AddToWallet(TX redacted) update entry in debug.log). I am also always calling estimatesmartfee and settxfee right before sendmany.

  8. fanquake commented at 0:27 am on November 22, 2021: member
    @lukaszsamson was this fixed by #22949?
  9. lukaszsamson commented at 9:30 am on November 22, 2021: none
    I can’t tell until we can test in in production so we are waiting for 22.1 release. Even after that the crash is rather rare - It happens about once a week.
  10. MarcoFalke commented at 9:35 am on November 22, 2021: member
    Ok, closing for now. Let us know if the issue still persists after 22.1, when it is released.
  11. MarcoFalke closed this on Nov 22, 2021

  12. DrahtBot locked this on Nov 22, 2022

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: 2024-11-21 21:12 UTC

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