DuplicateAddress
error easier and earlier.
wallet: Detect DuplicateAddress
earlier
#610
pull
hebasto
wants to merge
1
commits into
bitcoin-core:master
from
hebasto:220529-dupaddr
changing
1
files
+7 −11
-
hebasto commented at 5:25 pm on May 29, 2022: memberThis PR makes check for
-
qt, wallet: Detect `DuplicateAddress` earlier c6832ce992
-
hebasto added the label Wallet on May 29, 2022
-
furszy commented at 6:29 pm on May 29, 2022: member
Could move it even earlier in the flow and remove the code from the model (which requires the wallet to be locked):
Inside
SendCoinsDialog ::PrepareSendText
, before callingWalletModel::prepareTransaction
, we are looping over all the entries to load up the recipients list –> Line 257 ofSendCoinsDialog
. -
hebasto commented at 8:18 am on May 30, 2022: member
which requires the wallet to be locked
Do you mean “unlocking” using
WalletModel::UnlockContext
?Inside
SendCoinsDialog ::PrepareSendText
, before callingWalletModel::prepareTransaction
, we are looping over all the entries to load up the recipients list –> Line 257 ofSendCoinsDialog
.Would it make logic a bit messier?
-
furszy commented at 2:41 pm on May 30, 2022: member
Do you mean “unlocking” using WalletModel::UnlockContext?
Yeah. I skipped the first two letters.
Would it make logic a bit messier?
I think that the current logic is messy actually. We are already validating all the recipients’ data there. Check this out: https://github.com/furszy/bitcoin/commit/6115d09946b2fa3b25d005f748a5f9a0992c973b . I made the code flow cleaner there.
Before creating the recipient and adding it to the temporal recipients vector, we call to
SendCoinsEntry::validate
, which validates the address and the amount (failing if the address is invalid, or the amount is 0 or dust). So, when we are insideWalletModel:: prepareTransaction
, we already know whether the address and/or the amount are valid or not. Those checks are duplicated.I reworked the area a bit here (stopped after few commits to not enter in a long rabbit hole): https://github.com/furszy/bitcoin/commits/220529-dupaddr
Feel free to cherry-pick any of those commits if you like them, all yours :). Maybe we could team up to get deeper over this rabbit hole in follow-up PRs.
-
DrahtBot commented at 9:44 pm on June 12, 2022: contributor
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
Conflicts
No conflicts as of last run.
-
hebasto closed this on Oct 24, 2022
-
hebasto added the label Up for grabs on Oct 24, 2022
-
bitcoin-core locked this on Oct 24, 2023
Labels
Up for grabs
Wallet
This is a metadata mirror of the GitHub repository bitcoin-core/gui. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-21 12:20 UTC
More mirrored repositories can be found on mirror.b10c.me