No fee input added if deductFee is set to false and tx amount matches an account utxo
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.
@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?
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.
Discussed in Triage - P1, Maverick to discuss with Alex.
It's closed. Please reopen in case you notice anything suspicious.
Please retest
currently getting
InvalidRequestError: 9 FAILED_PRECONDITION: Transaction is rejected: tx-txlock-conflict (code 16)
@Alex-Werner please refer
retest failed:
InvalidRequestError: Transaction is rejected: min relay fee not met, 0 < 340 (code 66)
What in fact is the purpose of deduct_fee flag in that case? fyi @markin-io