tx.author addDestination to verify address#117
tx.author addDestination to verify address#117ReevesAk wants to merge 10 commits intoplanetdecred:masterfrom
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.
If an error occurs, the function must return.
There was a problem hiding this comment.
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.
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.
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) { | |||
|
Close by #147 |
addDestination function modified to verify address before adding it.
This closes issue #100