mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-28 04:01:40 +00:00
Fixes #121
This commit is contained in:
@ -174,7 +174,7 @@ func toStateAccount(acc *vm.Account) *acm.Account {
|
|||||||
if acc.StorageRoot.IsZero() {
|
if acc.StorageRoot.IsZero() {
|
||||||
storageRoot = nil
|
storageRoot = nil
|
||||||
} else {
|
} else {
|
||||||
storageRoot = acc.StorageRoot.Bytes()
|
storageRoot = acc.StorageRoot.Postfix(20)
|
||||||
}
|
}
|
||||||
return &acm.Account{
|
return &acm.Account{
|
||||||
Address: acc.Address.Postfix(20),
|
Address: acc.Address.Postfix(20),
|
||||||
|
24
state/tx_cache_test.go
Normal file
24
state/tx_cache_test.go
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
package state
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
. "github.com/tendermint/tendermint/common"
|
||||||
|
"github.com/tendermint/tendermint/wire"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestStateToFromVMAccount(t *testing.T) {
|
||||||
|
acmAcc1, _ := RandAccount(true, 456)
|
||||||
|
acmAcc1.StorageRoot = RandBytes(20)
|
||||||
|
vmAcc := toVMAccount(acmAcc1)
|
||||||
|
acmAcc2 := toStateAccount(vmAcc)
|
||||||
|
|
||||||
|
acmAcc1Bytes := wire.BinaryBytes(acmAcc1)
|
||||||
|
acmAcc2Bytes := wire.BinaryBytes(acmAcc2)
|
||||||
|
if !bytes.Equal(acmAcc1Bytes, acmAcc2Bytes) {
|
||||||
|
t.Errorf("Unexpected account wire bytes\n%X vs\n%X",
|
||||||
|
acmAcc1Bytes, acmAcc2Bytes)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Reference in New Issue
Block a user