core: allow to use state root in header

This commit is contained in:
Evgenii Stratonikov 2020-11-17 15:57:50 +03:00
parent 3025b42c65
commit 1869d6d460
37 changed files with 349 additions and 124 deletions

View file

@ -83,7 +83,7 @@ func (c *Client) getBlock(params request.RawParams) (*block.Block, error) {
return nil, err
}
r := io.NewBinReaderFromBuf(resp)
b = block.New(c.GetNetwork())
b = block.New(c.GetNetwork(), c.StateRootInHeader())
b.DecodeBinary(r)
if r.Err != nil {
return nil, r.Err
@ -606,6 +606,11 @@ func (c *Client) GetNetwork() netmode.Magic {
return c.network
}
// StateRootInHeader returns true if state root is contained in block header.
func (c *Client) StateRootInHeader() bool {
return c.stateRootInHeader
}
// GetNativeContractHash returns native contract hash by its name. It is not case-sensitive.
func (c *Client) GetNativeContractHash(name string) (util.Uint160, error) {
lowercasedName := strings.ToLower(name)