since v21 settxfee not working correctly #21737

issue PavelNiedoba openend this issue on April 20, 2021
  1. PavelNiedoba commented at 7:48 am on April 20, 2021: none

    We are using same code, which worked fine and stopped with update to v21. We use set tx fee before sending any tx.

    request {"method":"settxfee","params":[0.001020],"id":63824,"jsonrpc":"2.0","error":null}

    response {"result":true,"error":null,"id":63824}

    right after that we sent btc with {"method":"sendmany","params":["",{"3FMA2eRqd6ofp1sSifNXNNWPHzp5UW8rH2":0.04543},1,"",null,true],"id":63825,"jsonrpc":"2.0","error":null}

    which resulted in:

    (our custom response, but in short tx size is 223 bytes. fee 0.00014484 BTC, 65 sat/byte, when it should be 102 sat/byte)

    { "hash" : "969b9f19446145587af06eb87881fcf89d4e171606931959c4a731086ed5584e", "error" : null, "transaction" : { "javaClassName" : "cz.simplecoin.corewallets.http.dto.CryptoTransactionOutputDTO", "address" : "3FMA2eRqd6ofp1sSifNXNNWPHzp5UW8rH2", "amount" : -0.04543000, "outputId" : 1, "direction" : "Outgoing", "hash" : "969b9f19446145587af06eb87881fcf89d4e171606931959c4a731086ed5584e", "currency" : "BTC", "confirmations" : 0, "blockHeight" : null, "blockOrder" : null, "walletTimestamp" : 1618902716, "comment" : null, "walletName" : "BTC-Wallet", "fee" : -0.00014484, "fromAddress" : null, "fetchTimestampMillis" : 1618902716179, "zombie" : false, "walletOrder" : -1, "uuid" : "6fbae8c4-f314-5d96-9195-7f87f0b6f48b", "javaClassName" : "cz.simplecoin.corewallets.http.dto.CryptoTransactionOutputDTO" }, "javaClassName" : "cz.simplecoin.corewallets.http.dto.SendSingleDTO" }

    all transactions we send has fee rate 65sat/byte, i know there is new fee params using sat/byte instead btc/kb, but this should not be the case according doc.

    we have righ now chain of 100 unconfimed transactions and customers go insane

  2. PavelNiedoba added the label Bug on Apr 20, 2021
  3. fanquake added the label RPC/REST/ZMQ on Apr 20, 2021
  4. MarcoFalke commented at 7:57 am on April 20, 2021: member
    Do you have the long line in the debug.log that says “Fee Calculation: Fee: …”? It should be right before the line that says “CommitTransaction: …” with the txid.
  5. PavelNiedoba commented at 8:10 am on April 20, 2021: none

    relevan part od bitcoind log

     02021-04-20T07:11:55Z ThreadRPCServer method=settxfee user=BitcoinRpcUser
     12021-04-20T07:11:55Z ThreadRPCServer method=sendmany user=BitcoinRpcUser
     22021-04-20T07:11:55Z [default wallet] keypool added 1 keys (0 internal), size=2000 (1000 internal)
     32021-04-20T07:11:55Z [default wallet] keypool reserve 46324
     42021-04-20T07:11:55Z [default wallet] keypool keep 46324
     52021-04-20T07:11:55Z [default wallet] Fee Calculation: Fee:14484 Bytes:142 Needed:14484 Tgt:0 (requested 0) Reason:"PayTxFee set" Decay 0.00000: Estimation: (-1 - -1) 0.00%
     60.0/(0.0 0 mem 0.0 out) Fail: (-1 - -1) 0.00% 0.0/(0.0 0 mem 0.0 out)
     72021-04-20T07:11:56Z [default wallet] keypool added 1 keys (1 internal), size=2000 (1000 internal)
     82021-04-20T07:11:56Z [default wallet] keypool reserve 46325
     92021-04-20T07:11:56Z [default wallet] keypool keep 46325
    102021-04-20T07:11:56Z [default wallet] Fee Calculation: Fee:14484 Bytes:142 Needed:14484 Tgt:0 (requested 0) Reason:"PayTxFee set" Decay 0.00000: Estimation: (-1 - -1) 0.00%
    110.0/(0.0 0 mem 0.0 out) Fail: (-1 - -1) 0.00% 0.0/(0.0 0 mem 0.0 out)
    122021-04-20T07:11:56Z [default wallet] Fee non-grouped = 14484, grouped = 14484, using grouped
    132021-04-20T07:11:56Z [default wallet] CommitTransaction:
    14CTransaction(hash=969b9f1944, ver=2, vin.size=1, vout.size=2, nLockTime=679872)
    15    CTxIn(COutPoint(7598b819e3, 0), scriptSig=, nSequence=4294967293)
    16    CScriptWitness(304402205391f1695abf0e175100a588d35489500955c0bf4f18fe448ac857853d62eb7d0220565a813e4c1967dfbabd12db02a12c4f48e0fab28a9e459a97747034e9f2dce801, 03be6cff2d
    17e97051708a68bf082e57889bdd6b9cb8cc340cb4258d1279b2c7dcab)
    18    CTxOut(nValue=0.06442516, scriptPubKey=0014c5789266296fe05efdcb06999d)
    19    CTxOut(nValue=0.04543000, scriptPubKey=a91495d03527249655fd0154d89ced)
    202021-04-20T07:11:56Z [default wallet] AddToWallet 969b9f19446145587af06eb87881fcf89d4e171606931959c4a731086ed5584e  newupdate
    212021-04-20T07:11:56Z [default wallet] Submitting wtx 969b9f19446145587af06eb87881fcf89d4e171606931959c4a731086ed5584e to mempool for relay
    222021-04-20T07:11:56Z [default wallet] AddToWallet 969b9f19446145587af06eb87881fcf89d4e171606931959c4a731086ed5584e
    23`
    
  6. MarcoFalke commented at 8:55 am on April 20, 2021: member
    A fee of 14484 sat / 142 Byte is exactly 102 sat / Byte, as you requested.
  7. MarcoFalke commented at 8:58 am on April 20, 2021: member
    What is the entries “size”, “vsize” and “weight” if you call decoderawtransaction(gettransaction($txid)[hex])
  8. PavelNiedoba commented at 9:07 am on April 20, 2021: none

    A fee of 14484 sat / 142 Byte is exactly 102 sat / Byte, as you requested.

    resulting transaction is 223 bytes not 142

    i can’t decode the tx right now, but it’s still visible here

    https://www.blockchain.com/btc/tx/969b9f19446145587af06eb87881fcf89d4e171606931959c4a731086ed5584e

  9. MarcoFalke added the label Upstream on Apr 20, 2021
  10. MarcoFalke commented at 11:25 am on April 20, 2021: member
    Looks like an upstream bug on the explorer website
  11. PavelNiedoba commented at 7:35 pm on April 20, 2021: none
    i tried with new fee_rate param in sendsingle and sendmany, same problem persist, multiplying fee by 1.73 gets quite what we specify. bump fee works well
  12. MarcoFalke commented at 5:25 am on April 21, 2021: member

    Again, this is a bug on the block explorer website. There is nothing we can do here.

    If there is something we could do, we’d need the output of the RPC: #21737 (comment)

  13. MarcoFalke commented at 5:34 am on April 21, 2021: member

    Going to close this for now. Feel free to report the bug to the explorer website, which displays the wrong size.

    If this is our bug, we need steps to reproduce or the RPC output that shows the size is wrong.

  14. MarcoFalke closed this on Apr 21, 2021

  15. PavelNiedoba commented at 10:01 am on April 21, 2021: none

    I don’t understand. Set fee does not work. When I set transaction fee to 100sat/byte, resulting transaction fee will be 64 sat/byte and will not confirm. This started with v21. There is no bug on https://www.blockchain.com. I have no idea what makes you thing so. I’m using harcoded coeficient setFee(1.74 * fee) to get reasonable fees.

    A fee of 14484 sat / 142 Byte is exactly 102 sat / Byte, as you requested.

    resulting transaction is 223 bytes not 142

    i can’t decode the tx right now, but it’s still visible here

    https://www.blockchain.com/btc/tx/969b9f19446145587af06eb87881fcf89d4e171606931959c4a731086ed5584e

    As I stated here, size 142 is wrong, no bitcoin transaction can fit in that size. Please have somebody more experienced to review and reopen this issue

  16. MarcoFalke commented at 10:16 am on April 21, 2021: member

    Fee estimation, mempool policy, relay policy and block size (thus most likely miner prioritization of txs) is based on “virtual size” (vsize), not the size of the transaction in bytes.

    Your transaction may be 223 bytes in size when sent over the wire or displayed on your screen hex-encoded, but to determine the feerate, the “virtual size” is used. For your transaction the “virtual size” is 142 bytes.

    You can confirm it yourself with by calling the RPC:

    Screenshot from 2021-04-21 12-07-50

  17. PavelNiedoba commented at 10:33 am on April 21, 2021: none

    There is well established pricing sat/byte. For example https://bitcoinfees.earn.com/api/v1/fees/recommended, blockchain.com and all others calculate fee on size, not vsize

    more over

    documentation says

    0settxfee amount
    1Set the transaction fee per kB for this wallet. Overrides the global -paytxfee command line parameter.
    

    and previously is was kB of transaction size not vsize. This was changed, not documented and without good resson.

    what’s the point using vsize when business standard is just size ?

    What’s the relation between size and vsize? How do I set fee/size now?

  18. jonatack commented at 10:46 am on April 21, 2021: member

    @PavelNiedoba a pull request is open at #20391 to propose a setfeerate RPC denominated in sat/vB and to soft deprecate/replace settxfee that would become a hidden RPC, per the plan described in #20484 (comment). That PR also updates the settxfee documentation you mention, as seen here:

    https://github.com/bitcoin/bitcoin/pull/20391/files#diff-63c7710d72381cffe692175dd70e47f1891bf75c3e09249ed826f9df3917d02dR2313-R2316

    I might propose that doc update separately for the next release if #20391 isn’t merged.

  19. jonatack commented at 10:53 am on April 21, 2021: member
    @PavelNiedoba I believe the transaction size calculations changed back with segwit, see BIP141 https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#Transaction_size_calculations.
  20. MarcoFalke commented at 11:05 am on April 21, 2021: member
  21. MarcoFalke commented at 11:29 am on April 21, 2021: member

    @jonatack I see in commit 6da3afbaee5809ebf6d88efaa3958c505c2d71c7 you updated to /kvB. Was there a reason to skip the other /kB occurrences? Otherwise I’d say a scripted-diff doc commit makes sense here:

    0sed -i 's|/kB|/kvB|g' $( git grep -l '/kB' ./src )
    
  22. jonatack commented at 11:46 am on April 21, 2021: member
    Thanks for the script. IIRC I was a bit timid in that patch about proposing the change everywhere. I plan to pick back up the fee rate work Friday or this weekend.
  23. DrahtBot locked this on Aug 18, 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-12-21 15:12 UTC

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