aboutsummaryrefslogtreecommitdiffstats
path: root/core/types.go
diff options
context:
space:
mode:
authorSonic <sonic@dexon.org>2019-01-18 11:55:51 +0800
committerWei-Ning Huang <w@dexon.org>2019-04-09 21:32:56 +0800
commit88b3ad43fb7f7d69672a9ce42992b01e17ffbb5f (patch)
tree092628d1c460a676dd234f4a3fb54185a611405f /core/types.go
parent4848d54d3a497990030831cb10ea69274ddbd2f2 (diff)
downloaddexon-88b3ad43fb7f7d69672a9ce42992b01e17ffbb5f.tar
dexon-88b3ad43fb7f7d69672a9ce42992b01e17ffbb5f.tar.gz
dexon-88b3ad43fb7f7d69672a9ce42992b01e17ffbb5f.tar.bz2
dexon-88b3ad43fb7f7d69672a9ce42992b01e17ffbb5f.tar.lz
dexon-88b3ad43fb7f7d69672a9ce42992b01e17ffbb5f.tar.xz
dexon-88b3ad43fb7f7d69672a9ce42992b01e17ffbb5f.tar.zst
dexon-88b3ad43fb7f7d69672a9ce42992b01e17ffbb5f.zip
core, dex: use block hash as witness data (#160)
Using only state root and receipt root as witness data can not protect other fields in block header, ex: bloom, difficulty, gas limit, gas used... So that everyone can manipulate these fields to create as many valid blocks at the same height as he want. Although this will not effect the state, one can spam us when syncing. Using block hash as witness data can solve this.
Diffstat (limited to 'core/types.go')
-rw-r--r--core/types.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/core/types.go b/core/types.go
index 327031b01..04a787b1e 100644
--- a/core/types.go
+++ b/core/types.go
@@ -17,6 +17,7 @@
package core
import (
+ "github.com/dexon-foundation/dexon/common"
"github.com/dexon-foundation/dexon/core/state"
"github.com/dexon-foundation/dexon/core/types"
"github.com/dexon-foundation/dexon/core/vm"
@@ -35,7 +36,7 @@ type Validator interface {
ValidateState(block, parent *types.Block, state *state.StateDB, receipts types.Receipts, usedGas uint64) error
// ValidateWitnessData validates the given witness result.
- ValidateWitnessData(height uint64, data types.WitnessData) error
+ ValidateWitnessData(height uint64, data common.Hash) error
}
// Processor is an interface for processing blocks using a given initial state.