aboutsummaryrefslogtreecommitdiffstats
path: root/vm.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'vm.cpp')
-rw-r--r--vm.cpp26
1 files changed, 21 insertions, 5 deletions
diff --git a/vm.cpp b/vm.cpp
index fafb035f..55b8d79a 100644
--- a/vm.cpp
+++ b/vm.cpp
@@ -36,13 +36,19 @@ template <> class UnitTest<1>
public:
int operator()()
{
+ c_genesisDifficulty = (u256)1;
+
KeyPair p = KeyPair::create();
- Overlay o;
+ Overlay o(State::openDB("/tmp/vmTest", true));
State s(p.address(), o);
+ BlockChain bc("/tmp/vmTest", true);
cout << s;
- s.addBalance(p.address(), Uether);
+ s.commitToMine(bc);
+ s.mine(1000000);
+ bc.attemptImport(s.blockData(), o);
+ s.sync(bc);
cout << s;
@@ -50,7 +56,7 @@ public:
c.receiveAddress = Address();
c.nonce = 0;
- c.data = assemble("txsender load txvalue add txsender store stop");
+ c.data = assemble("txsender sload txvalue add txsender sstore stop");
c.value = ether;
c.sign(p.secret());
s.execute(c.rlp());
@@ -58,11 +64,14 @@ public:
cout << s;
- s.commit();
+ s.commitToMine(bc);
+ s.mine(1000000);
+ bc.attemptImport(s.blockData(), o);
+ s.sync(bc);
cout << s;
- cout << s.m_db;
+// cout << s.m_db;
c.receiveAddress = ca;
c.nonce = 1;
@@ -73,6 +82,13 @@ public:
cout << s;
+ s.commitToMine(bc);
+ s.mine();
+ bc.attemptImport(s.blockData(), o);
+ s.sync(bc);
+
+ cout << s;
+
return 0;
}
};