trezor / trezor-suite

Trezor Suite Monorepo
https://trezor.io/trezor-suite
Other
681 stars 246 forks source link

RBF ♻️ #675

Closed szymonlesisz closed 3 years ago

szymonlesisz commented 4 years ago

Design: Zeplin Spec: Notion

prusnak commented 4 years ago

We might also consider adding the CPFP button to fix the low-fee transaction.

andrewkozlik commented 3 years ago

@szymonlesisz the documentation for replacement transactions is located here: https://docs.trezor.io/trezor-firmware/common/communication/bitcoin-signing.html#replacement-transactions. Note that there are two new request types TXORIGINPUT and TXORIGOUTPUT documented here: https://docs.trezor.io/trezor-firmware/common/communication/bitcoin-signing.html#original-transaction-input

We have two device tests for RBF that you can use for reference:

  1. test_p2pkh_fee_bump which bumps the fee by decreasing a change output: https://github.com/trezor/trezor-firmware/blob/b9c0b3969b03943eb6d23383208411a08fd17c17/tests/device_tests/test_msg_signtx_replacement.py#L74
  2. test_p2wpkh_in_p2sh_remove_change which bumps the fee by removing a change output completely: https://github.com/trezor/trezor-firmware/blob/b9c0b3969b03943eb6d23383208411a08fd17c17/tests/device_tests/test_msg_signtx_replacement.py#L279
  3. You can also bump the fee by adding new inputs, but we don't have a special test for that.

In case you are wondering where the test suite gets the TXORIGINPUT and TXORIGOUTPUT information, it's pulling it straight from the cached transactions. In the two test cases above those would be: https://github.com/trezor/trezor-firmware/blob/master/tests/txcache/bitcoin/50f6f1209ca92d7359564be803cb2c932cde7d370f7cee50fd1fad6790f6206d.json https://github.com/trezor/trezor-firmware/blob/master/tests/txcache/testnet/334cd7ad982b3b15d07dd1c84e939e95efb0803071648048a7f289492e7b4c8a.json

In order to be able to test this, you currently need to enable experimental messages in Trezor using the command: trezorctl set experimental-features on I am not sure if this command is available in the released version of trezorctl. You might need to use the trezorctl from the master branch. In the next firmware release the messages will no longer be experimental, so users won't have to do this.

szymonlesisz commented 3 years ago

turns out blockbook doesn't send required data yet, see https://github.com/trezor/blockbook/issues/522

sorooris commented 3 years ago

QA OK

Suite Version: app + web 21.2.1 20f555f Browser: N/A + Chromium 88.0.4324.150 OS: macOS Big Sur 11.2 + NixOS 20.09 Firmware Version: model T 2.3.5 ffa96205f