core: review usages of (*intero.Context).BlockHeight method

This method returns persisted block height and doesn't take into account
persisting block height. Some of the callers of this method relay on
the wrong assumption that BlockHeight() returns persisting block index.

Fix improper usages of this method and adjust tests. Ref.
61a066583e/src/Neo/SmartContract/ApplicationEngine.cs (L634).

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
This commit is contained in:
Anna Shaleva 2023-11-21 10:49:05 +03:00
parent 80fcf81102
commit 3b11f98cd0
9 changed files with 28 additions and 17 deletions

View file

@ -34,7 +34,7 @@ func Call(ic *interop.Context) error {
if len(history) == 0 {
return fmt.Errorf("native contract %s is disabled", meta.Name)
}
if history[0] > ic.BlockHeight() {
if history[0] > ic.BlockHeight() { // persisting block must not be taken into account.
return fmt.Errorf("native contract %s is active after height = %d", meta.Name, history[0])
}
m, ok := meta.GetMethodByOffset(ic.VM.Context().IP())