Fixed couple issues

* (imp) Lock / RLock tries
* (fix) stack
This commit is contained in:
obscuren
2014-05-21 00:17:50 +02:00
parent e8b4585295
commit 5ceb1620e9
7 changed files with 71 additions and 26 deletions

View File

@ -4,6 +4,7 @@ import (
"fmt"
"github.com/ethereum/eth-go/ethdb"
"github.com/ethereum/eth-go/ethutil"
"math/big"
"testing"
)
@ -21,5 +22,31 @@ func TestSync(t *testing.T) {
state.Sync()
object := state.GetStateObject([]byte("aa"))
fmt.Printf("%x\n", object.Script())
if len(object.Script()) == 0 {
t.Fail()
}
}
func TestObjectGet(t *testing.T) {
ethutil.ReadConfig("", ethutil.LogStd)
db, _ := ethdb.NewMemDatabase()
ethutil.Config.Db = db
state := NewState(ethutil.NewTrie(db, ""))
contract := NewContract([]byte("aa"), ethutil.Big1, ZeroHash256)
state.UpdateStateObject(contract)
contract = state.GetStateObject([]byte("aa"))
contract.SetStorage(big.NewInt(0), ethutil.NewValue("hello"))
o := contract.GetMem(big.NewInt(0))
fmt.Println(o)
state.UpdateStateObject(contract)
contract.SetStorage(big.NewInt(0), ethutil.NewValue("hello00"))
contract = state.GetStateObject([]byte("aa"))
o = contract.GetMem(big.NewInt(0))
fmt.Println("after", o)
}