MCPcopy Create free account
hub / github.com/CPChain/chain / GetModifiedAccountsByNumber

Method GetModifiedAccountsByNumber

protocols/cpc/api.go:422–443  ·  view source on GitHub ↗

GetModifiedAccountsByNumber returns all accounts that have changed between the two blocks specified. A change is defined as a difference in nonce, balance, code hash, or storage hash. With one parameter, returns the list of accounts modified in the specified block.

(startNum uint64, endNum *uint64)

Source from the content-addressed store, hash-verified

420//
421// With one parameter, returns the list of accounts modified in the specified block.
422func (api *PrivateDebugAPI) GetModifiedAccountsByNumber(startNum uint64, endNum *uint64) ([]common.Address, error) {
423 var startBlock, endBlock *types.Block
424
425 startBlock = api.cpc.blockchain.GetBlockByNumber(startNum)
426 if startBlock == nil {
427 return nil, fmt.Errorf("start block %x not found", startNum)
428 }
429
430 if endNum == nil {
431 endBlock = startBlock
432 startBlock = api.cpc.blockchain.GetBlockByHash(startBlock.ParentHash())
433 if startBlock == nil {
434 return nil, fmt.Errorf("block %x has no parent", endBlock.Number())
435 }
436 } else {
437 endBlock = api.cpc.blockchain.GetBlockByNumber(*endNum)
438 if endBlock == nil {
439 return nil, fmt.Errorf("end block %d not found", *endNum)
440 }
441 }
442 return api.getModifiedAccounts(startBlock, endBlock)
443}
444
445// GetModifiedAccountsByHash returns all accounts that have changed between the
446// two blocks specified. A change is defined as a difference in nonce, balance,

Callers

nothing calls this directly

Calls 5

ParentHashMethod · 0.95
NumberMethod · 0.95
getModifiedAccountsMethod · 0.95
GetBlockByNumberMethod · 0.65
GetBlockByHashMethod · 0.65

Tested by

no test coverage detected