native: support postPersist method

It should be called for NEO contract to distribute
committee bounties.
This commit is contained in:
Evgenii Stratonikov 2020-09-23 11:48:31 +03:00
parent e8eb177c64
commit c5cdaae87a
10 changed files with 143 additions and 35 deletions

View file

@ -588,7 +588,7 @@ func TestSubscriptions(t *testing.T) {
require.NoError(t, err)
require.Eventually(t, func() bool { return len(blockCh) != 0 }, time.Second, 10*time.Millisecond)
assert.Len(t, notificationCh, 1) // validator bounty
assert.Len(t, executionCh, 1)
assert.Len(t, executionCh, 2)
assert.Empty(t, txCh)
b := <-blockCh
@ -597,6 +597,8 @@ func TestSubscriptions(t *testing.T) {
aer := <-executionCh
assert.Equal(t, b.Hash(), aer.TxHash)
aer = <-executionCh
assert.Equal(t, b.Hash(), aer.TxHash)
notif := <-notificationCh
require.Equal(t, bc.UtilityTokenHash(), notif.ScriptHash)
@ -669,11 +671,15 @@ func TestSubscriptions(t *testing.T) {
}
assert.Empty(t, txCh)
assert.Len(t, notificationCh, 1)
assert.Empty(t, executionCh)
assert.Len(t, executionCh, 1)
notif = <-notificationCh
require.Equal(t, bc.UtilityTokenHash(), notif.ScriptHash)
exec = <-executionCh
require.Equal(t, b.Hash(), exec.TxHash)
require.Equal(t, exec.VMState, vm.HaltState)
bc.UnsubscribeFromBlocks(blockCh)
bc.UnsubscribeFromTransactions(txCh)
bc.UnsubscribeFromNotifications(notificationCh)