Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

Commit

Permalink
Merge pull request #221 from weichang-bianjie/dev
Browse files Browse the repository at this point in the history
R4R:improve code about collect address only successful tx
  • Loading branch information
weichang-x authored Jul 13, 2020
2 parents 0ea8526 + 7cc42e8 commit 2a5d16e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion service/handler/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ import (
"encoding/json"
)

func saveNewAccount(tx document.CommonTx) {
//when new address not found or the tx is not success,this address will not be collected
func saveNewAccount(tx *document.CommonTx) {
var accountModel document.Account
if document.TxStatusSuccess != tx.Status {
return
}
switch tx.Type {
case constant.TxTypeTransfer:
accountModel.Address = tx.To
Expand Down
2 changes: 1 addition & 1 deletion service/handler/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func HandleTx(block *types.Block) (error) {
//handleTokenFlow(blockWithTags, tx, &batch)

// save new account address
saveNewAccount(tx)
saveNewAccount(&tx)
}

if len(batch) > 0 {
Expand Down

0 comments on commit 2a5d16e

Please sign in to comment.