Block validates a block and the transactions within. It does not check the predicate; for that, see ValidateBlockSig.
(b *bc.UnsignedBlock, prev *bc.BlockHeader)
| 81 | // Block validates a block and the transactions within. |
| 82 | // It does not check the predicate; for that, see ValidateBlockSig. |
| 83 | func Block(b *bc.UnsignedBlock, prev *bc.BlockHeader) error { |
| 84 | if b.Height > 1 { |
| 85 | if prev == nil { |
| 86 | return errors.WithDetailf(errNoPrevBlock, "height %d", b.Height) |
| 87 | } |
| 88 | err := BlockPrev(b, prev) |
| 89 | if err != nil { |
| 90 | return err |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | return BlockOnly(b) |
| 95 | } |
| 96 | |
| 97 | // BlockOnly performs those parts of block validation that depend only |
| 98 | // on the block and not on the previous block header. |