Added additional methods to the managed state

* GetNonce Returns the canonical nonce
* SetNonce Set the managed account's nonce
This commit is contained in:
obscuren
2015-04-08 13:04:23 +02:00
parent 09147a50ed
commit 31b086f511
2 changed files with 44 additions and 2 deletions

View File

@ -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))
}
}