diff options
author | obscuren <geffobscura@gmail.com> | 2015-04-08 19:04:23 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-04-08 19:06:56 +0800 |
commit | 31b086f5111e4bd506a4ae468a9247bff24dd5cb (patch) | |
tree | 793e3bf0bd88d963d7c7e9fe2255326a5747114a /core/state/managed_state_test.go | |
parent | 09147a50ede8c85022d115e23bb2ce067a50c8de (diff) | |
download | dexon-31b086f5111e4bd506a4ae468a9247bff24dd5cb.tar.gz dexon-31b086f5111e4bd506a4ae468a9247bff24dd5cb.tar.zst dexon-31b086f5111e4bd506a4ae468a9247bff24dd5cb.zip |
Added additional methods to the managed state
* GetNonce Returns the canonical nonce
* SetNonce Set the managed account's nonce
Diffstat (limited to 'core/state/managed_state_test.go')
-rw-r--r-- | core/state/managed_state_test.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/core/state/managed_state_test.go b/core/state/managed_state_test.go index b61f59e6d..766231d21 100644 --- a/core/state/managed_state_test.go +++ b/core/state/managed_state_test.go @@ -87,3 +87,21 @@ func TestRemoteNonceChange(t *testing.T) { t.Error("expected nonce after remote update to be", 201, "got", nonce) } } + +func TestSetNonce(t *testing.T) { + ms, _ := create() + + var addr common.Address + ms.SetNonce(addr, 10) + + if ms.GetNonce(addr) != 10 { + t.Errorf("Expected nonce of 10, got", ms.GetNonce(addr)) + } + + addr[0] = 1 + ms.StateDB.SetNonce(addr, 1) + + if ms.GetNonce(addr) != 1 { + t.Errorf("Expected nonce of 1, got", ms.GetNonce(addr)) + } +} |