ValidateBlockForSig performs validation on an incoming _unsigned_ block in preparation for signing it. By definition it does not execute the consensus program.
(ctx context.Context, block *legacy.Block)
| 225 | // block in preparation for signing it. By definition it does not |
| 226 | // execute the consensus program. |
| 227 | func (c *Chain) ValidateBlockForSig(ctx context.Context, block *legacy.Block) error { |
| 228 | var prev *legacy.Block |
| 229 | |
| 230 | if block.Height > 1 { |
| 231 | var err error |
| 232 | prev, err = c.GetBlock(ctx, block.Height-1) |
| 233 | if err != nil { |
| 234 | return errors.Wrap(err, "getting previous block") |
| 235 | } |
| 236 | } |
| 237 | |
| 238 | err := validation.ValidateBlock(legacy.MapBlock(block), legacy.MapBlock(prev), c.InitialBlockHash, c.ValidateTx) |
| 239 | return errors.Sub(ErrBadBlock, err) |
| 240 | } |
| 241 | |
| 242 | func NewInitialBlock(pubkeys []ed25519.PublicKey, nSigs int, timestamp time.Time) (*legacy.Block, error) { |
| 243 | // TODO(kr): move this into a lower-level package (e.g. chain/protocol/bc) |