ApplyValidBlock creates an updated snapshot without validating the block.
(block *legacy.Block)
| 139 | // ApplyValidBlock creates an updated snapshot without validating the |
| 140 | // block. |
| 141 | func (c *Chain) ApplyValidBlock(block *legacy.Block) (*state.Snapshot, error) { |
| 142 | newSnapshot := state.Copy(c.state.snapshot) |
| 143 | err := newSnapshot.ApplyBlock(legacy.MapBlock(block)) |
| 144 | if err != nil { |
| 145 | return nil, err |
| 146 | } |
| 147 | if block.AssetsMerkleRoot != newSnapshot.Tree.RootHash() { |
| 148 | return nil, ErrBadStateRoot |
| 149 | } |
| 150 | return newSnapshot, nil |
| 151 | } |
| 152 | |
| 153 | // CommitBlock commits a block to the blockchain. The block |
| 154 | // must already have been applied with ApplyValidBlock or |
no test coverage detected