DumpBlock retrieves the entire state of the database at a given block.
(blockNr rpc.BlockNumber)
| 285 | |
| 286 | // DumpBlock retrieves the entire state of the database at a given block. |
| 287 | func (api *PublicDebugAPI) DumpBlock(blockNr rpc.BlockNumber) (state.Dump, error) { |
| 288 | if blockNr == rpc.PendingBlockNumber { |
| 289 | // If we're dumping the pending state, we need to request |
| 290 | // both the pending block as well as the pending state from |
| 291 | // the miner and operate on those |
| 292 | _, stateDb := api.cpc.miner.Pending() |
| 293 | return stateDb.RawDump(), nil |
| 294 | } |
| 295 | var block *types.Block |
| 296 | if blockNr == rpc.LatestBlockNumber { |
| 297 | block = api.cpc.blockchain.CurrentBlock() |
| 298 | } else { |
| 299 | block = api.cpc.blockchain.GetBlockByNumber(uint64(blockNr)) |
| 300 | } |
| 301 | if block == nil { |
| 302 | return state.Dump{}, fmt.Errorf("block #%d not found", blockNr) |
| 303 | } |
| 304 | stateDb, err := api.cpc.BlockChain().StateAt(block.StateRoot()) |
| 305 | if err != nil { |
| 306 | return state.Dump{}, err |
| 307 | } |
| 308 | return stateDb.RawDump(), nil |
| 309 | } |
| 310 | |
| 311 | // DporPeers retrieves all the information we know about each individual peer |
| 312 | // at the dpor protocol level |
nothing calls this directly
no test coverage detected