btcwallet icon indicating copy to clipboard operation
btcwallet copied to clipboard

rpcclient: support numeric maxfeerate in bitcoind sendrawtransaction

Open cfromknecht opened this issue 5 years ago • 2 comments

In anticipation of bitcoind version 0.19, we will need to support a modification to the sendrawtransaction API to use a numeric field for maxfeerate instead of the current boolean value. The PR introducing the change is https://github.com/bitcoin/bitcoin/pull/13541 and is in master, so resolving this issue will allow us to test against master well before the release.

The current field can be found here: https://github.com/btcsuite/btcd/blob/86fed781132ac890ee03e906e4ecd5d6fa180c64/btcjson/chainsvrcmds.go#L640

We may also want to consider adding the ability to downgrade in the event that the user's backend is pre-0.19, which would require keeping the current struct. A new struct can be defined in btcd/rpcclient and we can toggle which to send here https://github.com/btcsuite/btcwallet/blob/master/chain/bitcoind_client.go#L195 depending on whether we have previously received an error that indicates the maxfeerate argument was expected to be boolean

original issue https://github.com/lightningnetwork/lnd/issues/2961

cfromknecht avatar Apr 17 '19 03:04 cfromknecht

If you want to support multiple API versions, I'd suggest to toggle based on the Bitcoin Core version. See https://github.com/bitcoin/bitcoin/blob/master/doc/JSON-RPC-interface.md#versioning

Unless you set "allowhighfees" to "true" somewhere, you could also remove it from the struct and rely on the default value. It is only required to send rpc parameters that don't have a default value.

maflcko avatar Apr 17 '19 12:04 maflcko

@MarcoFalke inspecting the version great suggestion, thank you. We should be able use the same approach w/ btcd as we'd like to keep the rpc interfaces as close as possible and so should switch to also supporting the numeric parameter

cfromknecht avatar Apr 18 '19 20:04 cfromknecht