From cd9ef69a925f3c61b8b22783a1d4ccb24833cdae Mon Sep 17 00:00:00 2001 From: warlock-wu Date: Fri, 17 Jan 2020 11:21:38 +0800 Subject: [PATCH] make useLess gasLimit as random seed --- app/app.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/app.go b/app/app.go index de642d3..faa8067 100755 --- a/app/app.go +++ b/app/app.go @@ -1,6 +1,7 @@ package app import ( + "crypto/rand" "encoding/binary" "fmt" "math" @@ -263,6 +264,11 @@ func (app *LinkApplication) CreateBlock(height uint64, maxTxs int, gasLimit uint } block.DataHash = block.Data.Hash() + b := make([]byte, 8) + if _, err := rand.Read(b); err == nil { + block.Header.GasLimit = binary.LittleEndian.Uint64(b) + } + app.logger.Info("CreateBlock: done", "height", height, "dataHash", block.DataHash, "NumTxs", len(txs)) return block }