aboutsummaryrefslogtreecommitdiffstats
path: root/core/block_validator.go
diff options
context:
space:
mode:
authorBojie Wu <bojie@dexon.org>2018-10-09 13:28:45 +0800
committerWei-Ning Huang <w@dexon.org>2019-03-12 12:19:09 +0800
commit8aa863c405dffa5c369408a85f482e9e6d1829b4 (patch)
treea1000eec6d6c6a4b24edf8c30d7cdffd3593f1b5 /core/block_validator.go
parent3afdb7dfc623f6d8c793fe15c3597655afe95fb6 (diff)
downloaddexon-8aa863c405dffa5c369408a85f482e9e6d1829b4.tar
dexon-8aa863c405dffa5c369408a85f482e9e6d1829b4.tar.gz
dexon-8aa863c405dffa5c369408a85f482e9e6d1829b4.tar.bz2
dexon-8aa863c405dffa5c369408a85f482e9e6d1829b4.tar.lz
dexon-8aa863c405dffa5c369408a85f482e9e6d1829b4.tar.xz
dexon-8aa863c405dffa5c369408a85f482e9e6d1829b4.tar.zst
dexon-8aa863c405dffa5c369408a85f482e9e6d1829b4.zip
app: implement new insert blocks logic
Diffstat (limited to 'core/block_validator.go')
-rw-r--r--core/block_validator.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/core/block_validator.go b/core/block_validator.go
index 697944c41..65f311f9f 100644
--- a/core/block_validator.go
+++ b/core/block_validator.go
@@ -101,6 +101,40 @@ func (v *BlockValidator) ValidateState(block, parent *types.Block, statedb *stat
return nil
}
+// BlockValidator implements Validator.
+type DexonBlockValidator struct {
+ config *params.ChainConfig // Chain configuration options
+ bc *BlockChain // Canonical block chain
+ engine consensus.Engine // Consensus engine used for validating
+}
+
+// NewDexonBlockValidator returns a new block validator which is safe for re-use
+func NewDexonBlockValidator(config *params.ChainConfig, blockchain *BlockChain, engine consensus.Engine) *DexonBlockValidator {
+ validator := &DexonBlockValidator{
+ config: config,
+ engine: engine,
+ bc: blockchain,
+ }
+ return validator
+}
+
+// ValidateBody validates the given block's uncles and verifies the block
+// header's transaction and uncle roots. The headers are assumed to be already
+// validated at this point.
+func (v *DexonBlockValidator) ValidateBody(block *types.Block) error {
+ // TODO(Bojie): implement it
+ return nil
+}
+
+// ValidateState validates the various changes that happen after a state
+// transition, such as amount of used gas, the receipt roots and the state root
+// itself. ValidateState returns a database batch if the validation was a success
+// otherwise nil and an error is returned.
+func (v *DexonBlockValidator) ValidateState(block, parent *types.Block, statedb *state.StateDB, receipts types.Receipts, usedGas uint64) error {
+ // TODO(Bojie): implement it
+ return nil
+}
+
// CalcGasLimit computes the gas limit of the next block after parent. It aims
// to keep the baseline gas above the provided floor, and increase it towards the
// ceil if the blocks are full. If the ceil is exceeded, it will always decrease