Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Commit

Permalink
fix the coinbase generate bug (#1136)
Browse files Browse the repository at this point in the history
  • Loading branch information
yahtoo authored and Paladz committed Jul 14, 2018
1 parent ede27cc commit f53cde9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mining/mining.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package mining

import (
"sort"
"strconv"
"time"

log "github.com/sirupsen/logrus"
Expand Down Expand Up @@ -39,7 +40,9 @@ func createCoinbaseTx(accountManager *account.Manager, amount uint64, blockHeigh
}

builder := txbuilder.NewBuilder(time.Now())
if err = builder.AddInput(types.NewCoinbaseInput([]byte(string(blockHeight))), &txbuilder.SigningInstruction{}); err != nil {
if err = builder.AddInput(types.NewCoinbaseInput(
append([]byte{0x00}, []byte(strconv.FormatUint(blockHeight, 10))...),
), &txbuilder.SigningInstruction{}); err != nil {
return
}
if err = builder.AddOutput(types.NewTxOutput(*consensus.BTMAssetID, amount, script)); err != nil {
Expand Down

0 comments on commit f53cde9

Please sign in to comment.