Skip to content

Commit

Permalink
make useLess gasLimit as random seed
Browse files Browse the repository at this point in the history
  • Loading branch information
warlock-wu authored and lianxiangcloud committed Feb 24, 2020
1 parent 561b112 commit cd9ef69
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package app

import (
"crypto/rand"
"encoding/binary"
"fmt"
"math"
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit cd9ef69

Please sign in to comment.