FIX: Outbound gas limit to be a feeRate not feeAmount
Current
Nodes are told to spend a maximum in feeAmount, but if the tx size changes at all, this can drastically increase/decrease the final fee rate and change priority untentionally.
Example:
"medianfee": 15405,
"mediantime": 1604450778,
"mediantxsize": 564,
median feeRate is then 15405/564 = 27sats/byte
For a typical (1 in, 2 out), the size is 148 * 1 + 10 + 10 * 2 = 178 bytes, so if told to spend up to 15405 * 1.5 sats, then the node will use a feeRate of ~110 sats/byte, which is massively overspending.
The other issue, is the node could be consuming a lot of UTXOs, (like 20 in, 2 out)
size: 148 * 20 + 10 + 10 * 2 = 3000 bytes
feeRate = 7 sats/byte,
Which means the transaction is well below and will get delayed.
Desired
Target a feeRate.
nodes should spend 1.5 * 27 = 40 sats/byte so no matter the size of the tx, it will be correct fee rate and get processed with desired priority.