[#1170] pkg/morph: Invalidate cache on RPC switch

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2022-03-31 16:12:42 +03:00 committed by Alex Vanin
parent 6508136204
commit 4ed5b1ceef
5 changed files with 58 additions and 25 deletions

View file

@ -873,13 +873,13 @@ func (c *Client) CalculateNonceAndVUB(hash util.Uint256) (nonce uint32, vub uint
}
func (c *Client) getTransactionHeight(h util.Uint256) (uint32, error) {
if rh, ok := c.txHeights.Get(h); ok {
if rh, ok := c.cache.txHeights.Get(h); ok {
return rh.(uint32), nil
}
height, err := c.client.GetTransactionHeight(h)
if err != nil {
return 0, err
}
c.txHeights.Add(h, height)
c.cache.txHeights.Add(h, height)
return height, nil
}