-
Notifications
You must be signed in to change notification settings - Fork 41
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
tx.author addDestination to verify address #117
tx.author addDestination to verify address #117
Conversation
txauthor.go
Outdated
func (tx *TxAuthor) AddSendDestination(address string, atomAmount int64, sendMax bool, wallet *Wallet) (verifyAddress bool) { | ||
_, err := dcrutil.DecodeAddress(address, wallet.chainParams) | ||
if err != nil { | ||
return | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If an error occurs, the function must return.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While you don't need to return a value when using named return variables (and I agree that using a named return variable makes the tx.AddSendDestination
method easier to understand), returning an explicit value in this instance makes more readable sense.
func (tx *TxAuthor) AddSendDestination(address string, atomAmount int64, sendMax bool, wallet *Wallet) (verifyAddress bool) { | |
_, err := dcrutil.DecodeAddress(address, wallet.chainParams) | |
if err != nil { | |
return | |
} | |
func (tx *TxAuthor) AddSendDestination(address string, atomAmount int64, sendMax bool, wallet *Wallet) (verifyAddress bool) { | |
_, err := dcrutil.DecodeAddress(address, wallet.chainParams) | |
if err != nil { | |
return false | |
} |
txauthor.go
Outdated
func (tx *TxAuthor) AddSendDestination(address string, atomAmount int64, sendMax bool, wallet *Wallet) (verifyAddress bool) { | ||
_, err := dcrutil.DecodeAddress(address, wallet.chainParams) | ||
if err != nil { | ||
return | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While you don't need to return a value when using named return variables (and I agree that using a named return variable makes the tx.AddSendDestination
method easier to understand), returning an explicit value in this instance makes more readable sense.
func (tx *TxAuthor) AddSendDestination(address string, atomAmount int64, sendMax bool, wallet *Wallet) (verifyAddress bool) { | |
_, err := dcrutil.DecodeAddress(address, wallet.chainParams) | |
if err != nil { | |
return | |
} | |
func (tx *TxAuthor) AddSendDestination(address string, atomAmount int64, sendMax bool, wallet *Wallet) (verifyAddress bool) { | |
_, err := dcrutil.DecodeAddress(address, wallet.chainParams) | |
if err != nil { | |
return false | |
} |
0334931
to
efe2393
Compare
txauthor.go
Outdated
func (tx *TxAuthor) SetSourceAccount(accountNumber int32) { | ||
tx.sendFromAccount = uint32(accountNumber) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes must have crept in from your last rebase. Please review and remove all changes NOT related to the fix this PR provides. This includes changes to your go.mod and go.sum files.
e22ab0f
to
efe2393
Compare
efe2393
to
afbb312
Compare
@@ -32,6 +32,10 @@ func (mw *MultiWallet) NewUnsignedTx(sourceWallet *Wallet, sourceAccountNumber i | |||
} | |||
|
|||
func (tx *TxAuthor) AddSendDestination(address string, atomAmount int64, sendMax bool) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Address this review and run go mod tidy
.
Close by #147 |
addDestination function modified to verify address before adding it.
This closes issue #100