diff options
author | obscuren <geffobscura@gmail.com> | 2015-01-06 07:17:05 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-01-06 07:17:05 +0800 |
commit | cc7f8f58e81b3607d5a003fe7789dadb7a99fe54 (patch) | |
tree | f2674e445a29d389feb7f372e981881831fe6a66 | |
parent | c9985bf563888d5f346408d2ff174167e8b65880 (diff) | |
download | dexon-cc7f8f58e81b3607d5a003fe7789dadb7a99fe54.tar dexon-cc7f8f58e81b3607d5a003fe7789dadb7a99fe54.tar.gz dexon-cc7f8f58e81b3607d5a003fe7789dadb7a99fe54.tar.bz2 dexon-cc7f8f58e81b3607d5a003fe7789dadb7a99fe54.tar.lz dexon-cc7f8f58e81b3607d5a003fe7789dadb7a99fe54.tar.xz dexon-cc7f8f58e81b3607d5a003fe7789dadb7a99fe54.tar.zst dexon-cc7f8f58e81b3607d5a003fe7789dadb7a99fe54.zip |
Limit block extra to 1024
-rw-r--r-- | core/block_processor.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/core/block_processor.go b/core/block_processor.go index 83399f472..127e97921 100644 --- a/core/block_processor.go +++ b/core/block_processor.go @@ -258,6 +258,10 @@ func (sm *BlockProcessor) CalculateTD(block *types.Block) (*big.Int, bool) { // an uncle or anything that isn't on the current block chain. // Validation validates easy over difficult (dagger takes longer time = difficult) func (sm *BlockProcessor) ValidateBlock(block, parent *types.Block) error { + if len(block.Header().Extra) > 1024 { + return fmt.Errorf("Block extra data too long (%d)", len(block.Header().Extra)) + } + expd := CalcDifficulty(block, parent) if expd.Cmp(block.Header().Difficulty) < 0 { return fmt.Errorf("Difficulty check failed for block %v, %v", block.Header().Difficulty, expd) |