Skip to content

Commit cd9ef69

Browse files
warlock-wulianxiangcloud
authored andcommitted
make useLess gasLimit as random seed
1 parent 561b112 commit cd9ef69

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

app/app.go

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package app
22

33
import (
4+
"crypto/rand"
45
"encoding/binary"
56
"fmt"
67
"math"
@@ -263,6 +264,11 @@ func (app *LinkApplication) CreateBlock(height uint64, maxTxs int, gasLimit uint
263264
}
264265
block.DataHash = block.Data.Hash()
265266

267+
b := make([]byte, 8)
268+
if _, err := rand.Read(b); err == nil {
269+
block.Header.GasLimit = binary.LittleEndian.Uint64(b)
270+
}
271+
266272
app.logger.Info("CreateBlock: done", "height", height, "dataHash", block.DataHash, "NumTxs", len(txs))
267273
return block
268274
}

0 commit comments

Comments
 (0)