Skip to content

Commit

Permalink
add debug_privateStateRoot API (for testing purposes) (#1148)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolae-leonte-go authored Mar 10, 2021
1 parent 3cfb956 commit e2397c2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions eth/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,14 @@ func (api *PublicDebugAPI) DumpBlock(blockNr rpc.BlockNumber, typ *string) (stat
return publicState.RawDump(false, false, true), nil
}

func (api *PublicDebugAPI) PrivateStateRoot(ctx context.Context, blockNr rpc.BlockNumber) (common.Hash, error) {
_, privateState, err := api.getStateDbsFromBlockNumber(blockNr)
if err != nil {
return common.Hash{}, err
}
return privateState.IntermediateRoot(true), nil
}

// Quorum
// DumpAddress retrieves the state of an address at a given block.
// Quorum adds an additional parameter to support private state dump
Expand Down
6 changes: 6 additions & 0 deletions internal/web3ext/web3ext.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,12 @@ web3._extend({
params: 2,
inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter, ""]
}),
new web3._extend.Method({
name: 'privateStateRoot',
call: 'debug_privateStateRoot',
params: 1,
inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter]
}),
new web3._extend.Method({
name: 'dumpAddress',
call: 'debug_dumpAddress',
Expand Down

0 comments on commit e2397c2

Please sign in to comment.