X-Git-Url: http://git.osdn.net/view?p=bytom%2Fvapor.git;a=blobdiff_plain;f=protocol%2Fvalidation%2Fblock.go;h=96c5bf94c760e33f4c909ab74cd5c2cc040a93c7;hp=2622a297bffcaf9ba05bf59693e586e6e10e395c;hb=2cf5801b2e693a45de9b51ec9aa9c1f787d57105;hpb=0dff3fcf4fbd306176d561d721c1c31e58d90742 diff --git a/protocol/validation/block.go b/protocol/validation/block.go index 2622a297..96c5bf94 100644 --- a/protocol/validation/block.go +++ b/protocol/validation/block.go @@ -6,7 +6,6 @@ import ( log "github.com/sirupsen/logrus" "github.com/vapor/consensus" - "github.com/vapor/consensus/difficulty" "github.com/vapor/errors" "github.com/vapor/protocol/bc" "github.com/vapor/protocol/bc/types" @@ -66,19 +65,11 @@ func ValidateBlockHeader(b *bc.Block, parent *state.BlockNode) error { if b.Height != parent.Height+1 { return errors.WithDetailf(errMisorderedBlockHeight, "previous block height %d, current block height %d", parent.Height, b.Height) } - if b.Bits != parent.CalcNextBits() { - return errBadBits - } if parent.Hash != *b.PreviousBlockId { return errors.WithDetailf(errMismatchedBlock, "previous block ID %x, current block wants %x", parent.Hash.Bytes(), b.PreviousBlockId.Bytes()) } - if err := checkBlockTime(b, parent); err != nil { - return err - } - if !difficulty.CheckProofOfWork(&b.ID, parent.CalcNextSeed(), b.BlockHeader.Bits) { - return errWorkProof - } - return nil + + return checkBlockTime(b, parent) } // ValidateBlock validates a block and the transactions within.