platform icon indicating copy to clipboard operation
platform copied to clipboard

No fee input added if deductFee is set to false and tx amount matches an account utxo

Open dashameter opened this issue 5 years ago • 9 comments

Consider a tx with the option deductFee: false and an amount of e.g. 2e6:

    const transaction = client.account.createTransaction({
      deductFee: false,
      recipients: [
        {
          recipient: "y...",
          satoshis: 2e6,
        },
      ],
    })

If the account has an UTXO with 2e6 the default strategy will select that sole input, apparently unaware of the deductFee: false option. As a result:

{code: 3, message: "invalid transaction: min relay fee not met, 0 < 192 (code 66). Code:-26", metadata: {…}}

is thrown since no additional input is added to cover the fee.

dashameter avatar Feb 09 '21 13:02 dashameter

@Alex-Werner are we tracking this bug to be fixed in one of the upcoming releases or shall we bounty it out to the incubator?

dashameter avatar Aug 31 '21 12:08 dashameter

It is tracked, it is groomed, and it is planned ready for being work on. Initial work about this one is that basically, we will return a proper error, as the use case here is to pay without specifying any fees and refusing the system to deduct fees by himselves. Such usage could be when after using the automatic UTXO selection, a user would want to decide of a specific input for payment. Without such modification, transaction will then have a single utxo as sole input, with single recipient, and no fees, therefore, it won't met the min relay fee and won't be proceeded.

Our way to "fix" that situation is by explaining to the user within broadcastTransaction in a min fee check that it won't be broadcastable. I don't think there is need to bounty that out, and we plan (as far as I know, still waiting confirmation) to have this fixed for v21.

Alex-Werner avatar Aug 31 '21 16:08 Alex-Werner

Discussed in Triage - P1, Maverick to discuss with Alex.

SamKirby22 avatar Sep 10 '21 09:09 SamKirby22

It's closed. Please reopen in case you notice anything suspicious.

dash-maverick avatar Sep 13 '21 11:09 dash-maverick

Please retest

dash-maverick avatar Sep 17 '21 08:09 dash-maverick

currently getting

 InvalidRequestError: 9 FAILED_PRECONDITION: Transaction is rejected: tx-txlock-conflict (code 16)

dashameter avatar Sep 29 '21 11:09 dashameter

@Alex-Werner please refer

dash-maverick avatar Oct 13 '21 14:10 dash-maverick

retest failed:

InvalidRequestError: Transaction is rejected: min relay fee not met, 0 < 340 (code 66)

dashameter avatar Jan 21 '22 12:01 dashameter

What in fact is the purpose of deduct_fee flag in that case? fyi @markin-io

dash-maverick avatar Jan 21 '22 13:01 dash-maverick