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

Add coin input control #5142

Merged
merged 16 commits into from
Feb 19, 2021
Merged

Conversation

chimp1984
Copy link
Contributor

@chimp1984 chimp1984 commented Feb 1, 2021

Adds input selection for BSQ send transactions. We use a utxo based model in contrast to the address based model in the Funds screen. If any dev wants to apply that to the funds screen as well would be good. Also it is better IMO to hide it in a popup as it is a bit technical and might confuse some users.

Screen Shot 2021-01-31 at 21 30 01

Screen Shot 2021-01-31 at 21 29 41

Copy link
Member

@sqrrm sqrrm left a comment

Choose a reason for hiding this comment

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

Testing issue:

  1. Start with a BSQ wallet with no BTC balance
  2. BSQ selection popup shows when button is pressed
  3. Send BTC to BSQ receive address (remove leading "B")
  4. BTC balance section shows in BSQ wallet but neither "select inputs" button work.

Comment on lines +330 to +335
// If we had some selection stored we need to update to already spent entries
bsqUtxoCandidates = bsqUtxoCandidates.stream().
filter(e -> unspentTransactionOutputs.contains(e)).
collect(Collectors.toSet());
Copy link
Member

Choose a reason for hiding this comment

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

This would remove transactions that are no longer spendable BSQ outputs from the selected outputs. I think that could be confusing. Better to check if the bsqUtxoCandidates are still all spendable, if they are then all is good, if not, then reset the selection to allow choosing between all unspentTransactionOutputs again.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To request the spendable via bsqWalletService.getSpendableBsqTransactionOutputs() and then check if the bsqUtxoCandidate is in that set does check if the bsqUtxoCandidate is spendable. We use the coinSelector for that and there is no API for checking one utxo if it is still spendable.

Or do I misunderstand what you mean?

Comment on lines +397 to +398
btcUtxoCandidates = btcUtxoCandidates.stream().
filter(e -> unspentTransactionOutputs.contains(e)).
collect(Collectors.toSet());
Copy link
Member

Choose a reason for hiding this comment

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

Same comment as for the BSQ, could be confusing if the selection changes without the users knowing about it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you make a send tx and spend a previous selected utxo we need to remove that. We always show that spendable utxos and those are marked the user has selected. A previous selected which got spent need to be removed.

@chimp1984
Copy link
Contributor Author

chimp1984 commented Feb 16, 2021

BTC balance section shows in BSQ wallet but neither "select inputs" button work.

There was a bug with the button handlers. Fixed in b37dc15

We use that to use only the selected utxos instead of all available.
…onOutputs

methods.
Add overridden getPreparedSendBsqTx and getPreparedSendBtcTx methods
with utxoCandidates param.

If utxoCandidates is not null we apply it to our coinSelector.
As the coin selector is re-used we re-set it immediately after
it was applied (inside coin selector select method).

Set preferences in nonBsqCoinSelector
It is both for BSQ and non-BSQ (BTC) used.
@ripcurlx
Copy link
Contributor

Would be great to reset the validation of the input fields similar as it was before, so it doesn't look like an error after coming back from the success popup.

Bildschirmfoto 2021-02-18 um 21 43 54

If text field is empty we apply ValidationResult(true), otherwise we apply
the validate result with the text and the given validator.
@ripcurlx ripcurlx added this to the v1.6.0 milestone Feb 19, 2021
Copy link
Member

@sqrrm sqrrm left a comment

Choose a reason for hiding this comment

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

ACK

@ripcurlx ripcurlx modified the milestones: v1.6.0, v1.5.7 Feb 19, 2021
@ripcurlx ripcurlx merged commit 314e6ce into bisq-network:master Feb 19, 2021
@ripcurlx ripcurlx modified the milestones: v1.5.7, v1.6.0 Feb 19, 2021
@chimp1984 chimp1984 deleted the add-coin-input-control branch November 18, 2021 00:56
@ghost ghost mentioned this pull request Apr 2, 2022
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