mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-05 23:55:11 +00:00
mpt: allow to remove non-existent keys in batch
This bug was here before batch were intoduced. `Delete` is allowed to be called on missing keys with HALT result, MPT needs to take this into account.
This commit is contained in:
parent
4d0681d898
commit
0cb6ec7345
6 changed files with 37 additions and 15 deletions
|
@ -1591,3 +1591,15 @@ func TestInvalidNotification(t *testing.T) {
|
|||
require.Nil(t, aer.Stack[0])
|
||||
require.Equal(t, stackitem.InteropT, aer.Stack[1].Type())
|
||||
}
|
||||
|
||||
// Test that deletion of non-existent doesn't result in error in tx or block addition.
|
||||
func TestMPTDeleteNoKey(t *testing.T) {
|
||||
bc := newTestChain(t)
|
||||
defer bc.Close()
|
||||
|
||||
cs, _ := getTestContractState(bc)
|
||||
require.NoError(t, bc.contracts.Management.PutContractState(bc.dao, cs))
|
||||
aer, err := invokeContractMethod(bc, 1_00000000, cs.Hash, "delValue", "non-existent-key")
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, vm.HaltState, aer.VMState)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue