Bitcoin-ABC / bitcoin-abc

Bitcoin ABC develops node software and infrastructure for the eCash project. This a mirror of the official Bitcoin-ABC repository. Please see README.md
https://reviews.bitcoinabc.org
MIT License
1.24k stars 790 forks source link

Cannot send out unconfirmed tx with RPC commands sendmany or sendtoaddress #381

Open tbrannt opened 4 years ago

tbrannt commented 4 years ago

To test certain scenarios it would be handy to be able to send out unconfirmed coins via the console. I found the following commands that I hoped enabled me to do this without crafting a raw tx: sendtoaddress and sendmany. Both - by default - do not allow sending of unconfirmed coins.

The Bitcoin Core RPC command sendtoaddress has the following arguments:

Arguments:
1. "dummy"               (string, required) Must be set to "" for backwards compatibility.
2. "amounts"             (string, required) A json object with addresses and amounts
    {
      "address":amount   (numeric or string) The bitcoin address is the key, the numeric amount (can be string) in BTC is the value
      ,...
    }
3. minconf                 (numeric, optional, default=1) Only use the balance confirmed at least this many times.
4. "comment"             (string, optional) A comment
5. subtractfeefrom         (array, optional) A json array with addresses.
                           The fee will be equally deducted from the amount of each selected address.
                           Those recipients will receive less bitcoins than you enter in their corresponding amount field.
                           If no addresses are specified here, the sender pays the fee.
    [
      "address"          (string) Subtract fee from this address
      ,...
    ]
6. replaceable            (boolean, optional) Allow this transaction to be replaced by a transaction with higher fees via BIP 125
7. conf_target            (numeric, optional) Confirmation target (in blocks)
8. "estimate_mode"      (string, optional, default=UNSET) The fee estimate mode, must be one of:
       "UNSET"
       "ECONOMICAL"
       "CONSERVATIVE"

The 7. conf_target arg is missing in BitcoinABC, why?

The sendmany command has the following args in BitcoinABC:

Arguments:
1. "dummy"               (string, required) Must be set to "" for backwards compatibility.
2. "amounts"             (string, required) A json object with addresses and amounts
    {
      "address":amount   (numeric or string) The bitcoin address is the key, the numeric amount (can be string) in BCH is the value
      ,...
    }
3. minconf                 (numeric, optional, default=1) Only use the balance confirmed at least this many times.
4. "comment"             (string, optional) A comment
5. subtractfeefrom         (array, optional) A json array with addresses.
                           The fee will be equally deducted from the amount of each selected address.

But when I set the minconf arg to 0 it still tells me the following in the console:

Insufficient funds (code -6

Why is 0 not supported as minconf? Is there another way to send unconfirmed coins?

jasonbcox commented 4 years ago

The most recent release (0.22.4) includes fixes that affect wallet balance and coin selection. Can you try out this version and let us know if it fixed this issue?