This is racy, as we knew when initially coding this. However, recent versions of Bitcoin Core (and other coin's clones) support a fee_rate argument for sendtoaddress that we should use instead.
10. fee_rate (numeric or string, optional, default=not set, fall back to wallet fee estimation) Specify a fee rate in sat/vB.
I'm not certain if we can use our current rpcclient easily though because it does not support named args (json object instead of positional args). We can try to just give all the defaults or empty args for the ones we don't want to set.
The settxfee approach may still be required for ancient forks like DOGE however.
https://github.com/decred/dcrdex/blob/b7f667d97c3f59e6d5e4a0ad42fa7911a06fb87d/client/asset/btc/rpcclient.go#L671-L684
This is racy, as we knew when initially coding this. However, recent versions of Bitcoin Core (and other coin's clones) support a
fee_rate
argument forsendtoaddress
that we should use instead.10. fee_rate (numeric or string, optional, default=not set, fall back to wallet fee estimation) Specify a fee rate in sat/vB.
I'm not certain if we can use our current rpcclient easily though because it does not support named args (json object instead of positional args). We can try to just give all the defaults or empty args for the ones we don't want to set.
The
settxfee
approach may still be required for ancient forks like DOGE however.