Skip to content

Commit b582c39

Browse files
committed
return hexutil
1 parent 6ecc311 commit b582c39

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

eth/api_debug.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ func (api *DebugAPI) GetTrieFlushInterval() (string, error) {
446446

447447
// StateSize returns the current state size statistics from the state size tracker.
448448
// Returns an error if the state size tracker is not initialized or if stats are not ready.
449-
func (api *DebugAPI) StateSize() (*state.SizeStats, error) {
449+
func (api *DebugAPI) StateSize() (interface{}, error) {
450450
sizer := api.eth.blockchain.StateSizer()
451451
if sizer == nil {
452452
return nil, errors.New("state size tracker is not enabled")
@@ -457,5 +457,18 @@ func (api *DebugAPI) StateSize() (*state.SizeStats, error) {
457457
return nil, errors.New("state size statistics are not ready yet")
458458
}
459459

460-
return stats, nil
460+
return map[string]interface{}{
461+
"stateRoot": stats.StateRoot,
462+
"blockNumber": hexutil.Uint64(stats.BlockNumber),
463+
"accounts": hexutil.Uint64(stats.Accounts),
464+
"accountBytes": hexutil.Uint64(stats.AccountBytes),
465+
"storages": hexutil.Uint64(stats.Storages),
466+
"storageBytes": hexutil.Uint64(stats.StorageBytes),
467+
"accountTrienodes": hexutil.Uint64(stats.AccountTrienodes),
468+
"accountTrienodeBytes": hexutil.Uint64(stats.AccountTrienodeBytes),
469+
"storageTrienodes": hexutil.Uint64(stats.StorageTrienodes),
470+
"storageTrienodeBytes": hexutil.Uint64(stats.StorageTrienodeBytes),
471+
"contractCodes": hexutil.Uint64(stats.ContractCodes),
472+
"contractCodeBytes": hexutil.Uint64(stats.ContractCodeBytes),
473+
}, nil
461474
}

0 commit comments

Comments
 (0)