sendtoaddress subtractfeefromamount=true does not respect paytxfee values #10034
issue cryptogenesis openend this issue on March 19, 2017-
cryptogenesis commented at 8:38 am on March 19, 2017: noneWhen using subtractfeeamount=true with the sendtoaddress RPC call, the wallet does not always respect paytxfee values and seems to occasionally employ an arbitrary (and very high! 0.004 BTC/KB at latest glance) fee. Strangely, after sending a standard call with subtractfeeamount=false, subsequent calls that include subtractfeeamount=true seem to respect the value set by paytxfee.
-
jonasschnelli added the label Wallet on Mar 19, 2017
-
jonasschnelli commented at 8:54 am on March 19, 2017: contributor
Can you write down some steps to reproduce… a little test told me if working correct. But maybe I’m wrong.
Started
./src/bitcoind -printtoconsole --regtest --paytxfee=100
Sent with SFA:./src/bitcoin-cli --regtest sendtoaddress n3NkSZqoPMCQN5FENxUBw4qVATbytH6FDK 1 "" "" true
List tx tells me:0 "details": [ 1 { 2 "account": "", 3 "address": "n3NkSZqoPMCQN5FENxUBw4qVATbytH6FDK", 4 "category": "send", 5 "amount": -0.90000000, 6 "label": "", 7 "vout": 1, 8 "fee": -0.10000000, 9 "abandoned": false 10 }
-
cryptogenesis commented at 9:00 am on March 19, 2017: none
Hi Jonas,
I have a bash script pay.sh that just calls:
#!/bin/bash bitcoin-cli sendtoaddress $1 $2 "" "" true
I then call this like ./pay.sh {address} {amount}
My current info is:
~/.bitcoin$ bitcoin-cli getinfo { “version”: 140000, “protocolversion”: 70015, “walletversion”: 130000, “balance”: X.XXXXXXXX, “blocks”: 457937, “timeoffset”: 0, “connections”: XX, “proxy”: “”, “difficulty”: 475705205061.6292, “testnet”: false, “keypoololdest”: 1489899731, “keypoolsize”: 100, “paytxfee”: 0.0016XXXX, “relayfee”: 0.00005000, “errors”: "" }
I routinely empty this wallet. I also have a CRON running on the hour that adjusts fees to target 5 block confirmation:
#!/bin/bash FEE="$(bitcoin-cli estimatefee 5)" bitcoin-cli settxfee $FEE
However, when I call pay.sh for the first time after receiving a deposit, it doesn’t seem to respect the value of paytxfee (and has been paying 0.004 BTC/KB). I noticed that if I call the sendtoaddress command without referencing subtractfeefromamount, and then call my pay.sh script, the subtractfeefromamount will then reference the correctly defined paytxfee. Very odd to say the least.
I am happy to provide txids privately if you’d like which will demonstrate the behavior above.
Thank you for taking a look.
-
MarcoFalke commented at 9:07 am on March 19, 2017: memberIf this only and always happens the fist time you send, there might be a bug in your code to set fees. Otherwise, this is might be an instance of the known issue: https://github.com/bitcoin/bitcoin/blob/baae3149d63909c527e7b28c52c9124957ce8206/src/wallet/wallet.cpp#L2567
-
MarcoFalke added the label Bug on Mar 19, 2017
-
MarcoFalke added the label Priority Medium on Mar 19, 2017
-
MarcoFalke added this to the milestone 0.15.0 on Mar 19, 2017
-
laanwj assigned morcos on Jul 27, 2017
-
morcos commented at 7:14 pm on July 27, 2017: member
@cryptogenesis sorry for the delay, but i’m going to take another look at this. If you’d be willing to point me to a few txid’s, i’m not sure if it will help or not
morcos at chaincode.com
Thanks
-
morcos commented at 9:29 pm on July 27, 2017: member
@cryptogenesis I opened #10942 to fix a (hopefully very rare) edge case that was not yet fixed. But I’m not sure that’s the cause of your issue.
You are sure that the estimatefee call wasn’t sometimes causing you to settxfee to a higher feerate?
I looked through the code and didn’t see anything obviously wrong, but am willing to look more if you have more information (I realize its quite old now).
-
laanwj referenced this in commit 2e857bb619 on Aug 3, 2017
-
MarcoFalke commented at 11:44 am on August 3, 2017: member
-
MarcoFalke closed this on Aug 3, 2017
-
PastaPastaPasta referenced this in commit 63d259e5f5 on Aug 6, 2019
-
PastaPastaPasta referenced this in commit 0441bf2cbd on Aug 6, 2019
-
PastaPastaPasta referenced this in commit 778404621a on Aug 6, 2019
-
PastaPastaPasta referenced this in commit bdc7ca1fdc on Aug 7, 2019
-
PastaPastaPasta referenced this in commit 4d6bc0e571 on Aug 8, 2019
-
PastaPastaPasta referenced this in commit e72a2e278f on Aug 12, 2019
-
barrystyle referenced this in commit 013237fbcd on Jan 22, 2020
-
MarcoFalke locked this on Sep 8, 2021
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-16 18:12 UTC
More mirrored repositories can be found on mirror.b10c.me