diff options
author | Gav Wood <i@gavwood.com> | 2014-01-21 02:43:11 +0800 |
---|---|---|
committer | Gav Wood <i@gavwood.com> | 2014-01-21 02:43:11 +0800 |
commit | 8ab00968cbb09db65f45045ca8198cf402d00796 (patch) | |
tree | ed1112a8ad2e3bb0135548d0a07e4f1e77aa0a05 /state.cpp | |
parent | a08ce2bde1ea3f7650251e96c62389166972a249 (diff) | |
download | dexon-solidity-8ab00968cbb09db65f45045ca8198cf402d00796.tar.gz dexon-solidity-8ab00968cbb09db65f45045ca8198cf402d00796.tar.zst dexon-solidity-8ab00968cbb09db65f45045ca8198cf402d00796.zip |
Working state-transition test.
Diffstat (limited to 'state.cpp')
-rw-r--r-- | state.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -35,30 +35,43 @@ int stateTest() BlockChain bc("/tmp"); State s(myMiner.address(), "/tmp"); + cout << dec << "me: " << s.balance(me.address()) << endl; + cout << "myMiner: " << s.balance(myMiner.address()) << endl; + // Mine to get some ether! s.commitToMine(bc); while (!s.mine(100)) {} bc.attemptImport(s.blockData()); s.sync(bc); + cout << "me: " << s.balance(me.address()) << endl; + cout << "myMiner: " << s.balance(myMiner.address()) << endl; + bytes tx; { Transaction t; t.nonce = s.transactionsFrom(myMiner.address()); t.fee = 0; - t.value = 1000000000; // 1e9 wei. + t.value = 1000; // 1e3 wei. t.receiveAddress = me.address(); t.sign(myMiner.secret()); + assert(t.sender() == myMiner.address()); tx = t.rlp(); } - cout << RLP(tx) << endl; s.execute(tx); + cout << "me: " << s.balance(me.address()) << endl; + cout << "myMiner: " << s.balance(myMiner.address()) << endl; + s.commitToMine(bc); while (!s.mine(100)) {} bc.attemptImport(s.blockData()); s.sync(bc); + cout << "me: " << s.balance(me.address()) << endl; + cout << "myMiner: " << s.balance(myMiner.address()) << endl; +// s.dumpAccounts(); + return 0; } |