HomePhabricator

[electrum] refactor: extract stakes widget from proof editor

Description

[electrum] refactor: extract stakes widget from proof editor

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.

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D14760

Details

Provenance
PiRKAuthored on Nov 9 2023, 11:29
PiRKPushed on Nov 9 2023, 15:46
Reviewer
Restricted Project
Differential Revision
D14760: [electrum] refactor: extract stakes widget from proof editor
Parents
rABCdeaad9c4ff71: [net_processing] fix compact block related comment
Branches
Unknown
Tags
Unknown