aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2018-09-10 22:12:39 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-09-11 21:40:00 +0800
commit4bb25042eb957662155079e06bb2efbdd866eb99 (patch)
tree87e6833f5c30b0bf2cec878f4689f689572c058b /core
parent10bac3664702f31228eafedecf31e9bf115f6c29 (diff)
downloadgo-tangerine-4bb25042eb957662155079e06bb2efbdd866eb99.tar
go-tangerine-4bb25042eb957662155079e06bb2efbdd866eb99.tar.gz
go-tangerine-4bb25042eb957662155079e06bb2efbdd866eb99.tar.bz2
go-tangerine-4bb25042eb957662155079e06bb2efbdd866eb99.tar.lz
go-tangerine-4bb25042eb957662155079e06bb2efbdd866eb99.tar.xz
go-tangerine-4bb25042eb957662155079e06bb2efbdd866eb99.tar.zst
go-tangerine-4bb25042eb957662155079e06bb2efbdd866eb99.zip
consensus/clique, core: chain maker clique + error tests
Diffstat (limited to 'core')
-rw-r--r--core/chain_makers.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/core/chain_makers.go b/core/chain_makers.go
index de0fc6be9..351673477 100644
--- a/core/chain_makers.go
+++ b/core/chain_makers.go
@@ -67,6 +67,11 @@ func (b *BlockGen) SetExtra(data []byte) {
b.header.Extra = data
}
+// SetNonce sets the nonce field of the generated block.
+func (b *BlockGen) SetNonce(nonce types.BlockNonce) {
+ b.header.Nonce = nonce
+}
+
// AddTx adds a transaction to the generated block. If no coinbase has
// been set, the block's coinbase is set to the zero address.
//
@@ -190,13 +195,14 @@ func GenerateChain(config *params.ChainConfig, parent *types.Block, engine conse
if config.DAOForkSupport && config.DAOForkBlock != nil && config.DAOForkBlock.Cmp(b.header.Number) == 0 {
misc.ApplyDAOHardFork(statedb)
}
- // Execute any user modifications to the block and finalize it
+ // Execute any user modifications to the block
if gen != nil {
gen(i, b)
}
-
if b.engine != nil {
+ // Finalize and seal the block
block, _ := b.engine.Finalize(b.chainReader, b.header, statedb, b.txs, b.uncles, b.receipts)
+
// Write state changes to db
root, err := statedb.Commit(config.IsEIP158(b.header.Number))
if err != nil {