diff --git a/error.go b/error.go index 974d33c9..31853c59 100644 --- a/error.go +++ b/error.go @@ -62,10 +62,14 @@ const ( // checkpoint height does not match the expected one. ErrBadCheckpoint - // ErrForkTooOld indicates a block is attempted to fork the block chain + // ErrForkTooOld indicates a block is attempting to fork the block chain // before the most recent checkpoint. ErrForkTooOld + // ErrCheckpointTimeTooOld indicates a block has a timestamp before the + // most recent checkpoint. + ErrCheckpointTimeTooOld + // ErrNoTransactions indicates the block does not have a least one // transaction. A valid block must have at least the coinbase // transaction. @@ -190,6 +194,7 @@ var errorCodeStrings = map[ErrorCode]string{ ErrBadMerkleRoot: "ErrBadMerkleRoot", ErrBadCheckpoint: "ErrBadCheckpoint", ErrForkTooOld: "ErrForkTooOld", + ErrCheckpointTimeTooOld: "ErrCheckpointTimeTooOld", ErrNoTransactions: "ErrNoTransactions", ErrTooManyTransactions: "ErrTooManyTransactions", ErrNoTxInputs: "ErrNoTxInputs", diff --git a/error_test.go b/error_test.go index 20f6f58c..4f7b3398 100644 --- a/error_test.go +++ b/error_test.go @@ -28,6 +28,7 @@ func TestErrorCodeStringer(t *testing.T) { {btcchain.ErrBadMerkleRoot, "ErrBadMerkleRoot"}, {btcchain.ErrBadCheckpoint, "ErrBadCheckpoint"}, {btcchain.ErrForkTooOld, "ErrForkTooOld"}, + {btcchain.ErrCheckpointTimeTooOld, "ErrCheckpointTimeTooOld"}, {btcchain.ErrNoTransactions, "ErrNoTransactions"}, {btcchain.ErrTooManyTransactions, "ErrTooManyTransactions"}, {btcchain.ErrNoTxInputs, "ErrNoTxInputs"}, diff --git a/process.go b/process.go index e86103b1..55927afd 100644 --- a/process.go +++ b/process.go @@ -165,7 +165,7 @@ func (b *BlockChain) ProcessBlock(block *btcutil.Block, flags BehaviorFlags) (bo str := fmt.Sprintf("block %v has timestamp %v before "+ "last checkpoint timestamp %v", blockHash, blockHeader.Timestamp, checkpointTime) - return false, ruleError(ErrTimeTooOld, str) + return false, ruleError(ErrCheckpointTimeTooOld, str) } if !fastAdd { // Even though the checks prior to now have already ensured the