GetSnapshot retrieves the state Snapshot at a given block.
(number rpc.BlockNumber)
| 17 | |
| 18 | // GetSnapshot retrieves the state Snapshot at a given block. |
| 19 | func (api *API) GetSnapshot(number rpc.BlockNumber) (*DporSnapshot, error) { |
| 20 | // Retrieve the requested block number (or current if none requested) |
| 21 | var header *types.Header |
| 22 | if number == 0 || number == rpc.LatestBlockNumber { |
| 23 | header = api.chain.CurrentHeader() |
| 24 | } else { |
| 25 | header = api.chain.GetHeaderByNumber(uint64(number.Int64())) |
| 26 | } |
| 27 | // Ensure we have an actually valid block and return its Snapshot |
| 28 | if header == nil { |
| 29 | return nil, errUnknownBlock |
| 30 | } |
| 31 | return api.dpor.dh.snapshot(api.dpor, api.chain, header.Number.Uint64(), header.Hash(), nil) |
| 32 | } |
| 33 | |
| 34 | // GetSnapshotAtHash retrieves the state Snapshot at a given block. |
| 35 | func (api *API) GetSnapshotAtHash(hash common.Hash) (*DporSnapshot, error) { |
nothing calls this directly
no test coverage detected