Skip to content

Commit

Permalink
fix rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
ChihChengLiang committed Nov 11, 2020
1 parent 9ad46ce commit 1ea44fe
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
3 changes: 0 additions & 3 deletions cmd/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,5 @@ const (
FlagPubKey = "pubkey"
FlagAmount = "amount"
FlagFee = "fee"
FlagSignature = "sig"
FlagNonce = "nonce"
FlagTokenID = "token"
FlagDatabaseName = "dbname"
)
19 changes: 16 additions & 3 deletions cmd/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,13 @@ func sendTransferTx() *cobra.Command {
cmd.Flags().StringP(FlagPrivKey, "", "", "--privkey=<privkey>")
cmd.Flags().StringP(FlagAmount, "", "", "--amount=<amount>")
err := cmd.MarkFlagRequired(FlagToID)
common.PanicIfError(err)
err = cmd.MarkFlagRequired(FlagFromID)
common.PanicIfError(err)
err = cmd.MarkFlagRequired(FlagPubKey)
common.PanicIfError(err)
err = cmd.MarkFlagRequired(FlagPrivKey)
common.PanicIfError(err)
err = cmd.MarkFlagRequired(FlagAmount)
common.PanicIfError(err)
return cmd
Expand Down Expand Up @@ -172,9 +176,18 @@ func validateAndTransfer(db core.DB, bazooka core.Bazooka, fromIndex, toIndex, a
return
}

tx := core.NewPendingTx(fromIndex, toIndex, core.TX_TRANSFER_TYPE, []byte(""), txData)
tx.SignTx(priv, pub, common.Keccak256(tx.GetSignBytes()))
tx.AssignHash()
tx, err := core.NewPendingTx(fromIndex, toIndex, core.TX_TRANSFER_TYPE, []byte(""), txData)
if err != nil {
return
}
err = tx.SignTx(priv, pub, common.Keccak256(tx.GetSignBytes()))
if err != nil {
return
}
err = tx.AssignHash()
if err != nil {
return
}

fmt.Println("Sending new tx", tx.String())

Expand Down

0 comments on commit 1ea44fe

Please sign in to comment.