Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gui: add warnings for descendant & conflicting transactions that will be dropped #930

Conversation

jp1ac4
Copy link
Collaborator

@jp1ac4 jp1ac4 commented Jan 23, 2024

This is for #903.

It adds two warnings to the GUI:

  • when creating a new RBF if there are any descendant transactions of the transaction to be replaced:
    image

  • when broadcasting a transaction if there are any conflicting transactions
    image

These warnings are generated in the GUI using coins data from the DB and so will not appear if the DB coins have not yet been updated. Would resolving #887 help ensure the coins are updated before running these checks?

@jp1ac4 jp1ac4 force-pushed the gui-rbf-warn-descendant-coin-spending branch 2 times, most recently from bd31e14 to 6f90d74 Compare January 23, 2024 11:06
Copy link
Member

@darosior darosior left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approach ACK.

These warnings are generated in the GUI using coins data from the DB and so will not appear if the DB coins have not yet been updated. Would resolving #887 help ensure the coins are updated before running these checks?

In most cases yes. It wouldn't cover it if it was just broadcast from another wallet (one such realistic scenario would be in the case of a multi-user wallet such as a multisig). But i think that's fine.

Comment on lines 170 to 172
"WARNING: The following transaction{} spending one or more \
inputs from the transaction to be broadcast and will be \
dropped, along with any other transactions that depend on {}:",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's have a higher level first sentence before the technical transaction dependency description? I'm thinking something along the lines of "WARNING: replacing this transaction would invalidate some later payments. [...]".

Comment on lines 198 to 201
"WARNING: The following transaction{} spending one or \
more outputs from the transaction to be replaced and will \
be dropped when the replacement is broadcast, along with \
any other transactions that depend on {}:",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

@jp1ac4 jp1ac4 force-pushed the gui-rbf-warn-descendant-coin-spending branch from 6f90d74 to 802e0ee Compare January 25, 2024 14:19
@jp1ac4
Copy link
Collaborator Author

jp1ac4 commented Jan 25, 2024

I've made some changes to the wording as suggested. I also added the option to copy the transaction ID with a copy icon.

Here are some screenshots for the broadcast warning:

  • a single transaction:
    image

  • more than one transaction:
    image

For cancelling a transaction:

  • a single transaction:
    image

  • more than one transaction:
    image

And for bumping the fee:
image

I also reworded the existing "cancel transaction" message to mention sending coins "back to your wallet" instead of "back to us".

@jp1ac4 jp1ac4 marked this pull request as ready for review January 25, 2024 14:39
@darosior
Copy link
Member

That looks very good. Thank you for all the screenshots.

@@ -126,8 +127,24 @@ impl State for TransactionsPanel {
.to_sat()
.checked_div(tx.tx.vsize().try_into().unwrap())
.unwrap();
let modal =
CreateRbfModal::new(tx.tx.txid(), is_cancel, prev_feerate_vb);
let descendant_txids: HashSet<_> = cache
Copy link
Member

@edouardparis edouardparis Jan 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like we do not use the cache coins for this usage. cache is generally used to display something like the previous balance, while the new balance is calculated in order to not display zero values.

I think it would be good instead, to have CreateRbfModal::new() -> (modal, command)
and give the command result to modal.update so it updates its conflicting txids.

The command would be an iced Command that use the daemon.list_coins and filter it and returns the Message::ConflictingRbfTransactions(Result<Vec, Error>)

What do you think ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds good thanks, I'll make this change. After we implement #677, then we'll be able to retrieve just the spending coins in this call.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've now made the change to use daemon.list_coins and pass the result to another message.

In the end, I didn't pass the result to modal.update because when I tried this, the modal would open without any warnings and then update shortly afterwards, and I felt it was better that the warnings would be there as soon as the modal opened. So the modal is created using the result of list_coins.

I made a similar change for the set of conflicting transactions when broadcasting a transaction.

@jp1ac4 jp1ac4 force-pushed the gui-rbf-warn-descendant-coin-spending branch from 802e0ee to fde28bf Compare February 1, 2024 17:16
@jp1ac4
Copy link
Collaborator Author

jp1ac4 commented Feb 1, 2024

As well as the changes discussed above in #930 (comment), I've also removed the prev_feerate_vb parameter from CreateRbfModal::new() as this value can now be obtained from the tx parameter.

In order for the new BroadcastModal message handler to access Error instead of &Error, I changed the match statement to use message instead of &message.

Copy link
Member

@edouardparis edouardparis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK fde28bf

@edouardparis edouardparis merged commit 445a8c1 into wizardsardine:master Feb 2, 2024
18 checks passed
@jp1ac4 jp1ac4 deleted the gui-rbf-warn-descendant-coin-spending branch February 28, 2024 07:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants