Page MenuHomePhabricator

[electrum] refactor: extract stakes widget from proof editor
ClosedPublic

Authored by PiRK on Nov 9 2023, 11:44.

Details

Summary

Move the stake related code out of the proof widget into a new StakesWidget.
For now the StakesWidget does not deal with raw UTXOs or with the wallet, it receives directly SignedStakes or StakeAndKeys objects.

Some interactivity will be added in a following commit, to allow users to remove stakes.

There is a minor change in behavior regarding the stake maturity status. Previously the tip height was checked for each stake at the time of adding it to the list, leading to potential inconsistencies (the maturity of stakes added later could be computed from a later block height than previously added stakes). Now the tip height is set once, at the widget's initialization. This allows removing a self.wallet reference from the add_stakes method. Properly handling the tip updates in real time and updating the stake color when the maturity is reached is probably not worth the effort.

Can be reviewed with git show --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space

Test Plan

Select a few coins in the coins tab with different maturity status, right click and "Build avalanche proof".
Add a few more coins from the wallet, from a JSON file, from another proof ("merge stakes" button).
Load a proof in the editor.

Diff Detail

Repository
rABC Bitcoin ABC
Branch
proof_delete_coins
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 25578
Build 50737: Build Diffelectrum-tests
Build 50736: arc lint + arc unit