Fill coinbase transaction data with random bytes
This commit is contained in:
parent
ffac3de519
commit
9b9b571028
|
@ -173,7 +173,13 @@ func (tx *Transaction) Verify(prevTXs map[string]Transaction) bool {
|
|||
// NewCoinbaseTX creates a new coinbase transaction
|
||||
func NewCoinbaseTX(to, data string) *Transaction {
|
||||
if data == "" {
|
||||
data = fmt.Sprintf("Reward to '%s'", to)
|
||||
randData := make([]byte, 20)
|
||||
_, err := rand.Read(randData)
|
||||
if err != nil {
|
||||
log.Panic(err)
|
||||
}
|
||||
|
||||
data = fmt.Sprintf("%x", randData)
|
||||
}
|
||||
|
||||
txin := TXInput{[]byte{}, -1, nil, []byte(data)}
|
||||
|
|
Loading…
Reference in New Issue