mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fake dagger, and moves to test the state transitions.
This commit is contained in:
parent
b73cbf3ecb
commit
6eafb9e6f8
32
state.cpp
32
state.cpp
@ -24,9 +24,39 @@
|
||||
using namespace std;
|
||||
using namespace eth;
|
||||
|
||||
struct KeyPair
|
||||
{
|
||||
KeyPair() {}
|
||||
KeyPair(PrivateKey _k): priv(_k), addr(toPublic(_k)) {}
|
||||
PrivateKey priv;
|
||||
Address addr;
|
||||
};
|
||||
|
||||
int stateTest()
|
||||
{
|
||||
State s(toPublic(sha3("123")));
|
||||
KeyPair me = sha3("Gav Wood");
|
||||
KeyPair myMiner = sha3("Gav's Miner");
|
||||
// KeyPair you = sha3("123");
|
||||
|
||||
State s(myMiner.addr);
|
||||
|
||||
// Mine to get some ether!
|
||||
s.mine();
|
||||
|
||||
bytes tx;
|
||||
{
|
||||
Transaction t;
|
||||
t.nonce = s.transactionsFrom(myMiner.addr);
|
||||
t.fee = 0;
|
||||
t.value = 1; // 1 wei.
|
||||
t.receiveAddress = me.addr;
|
||||
t.sign(myMiner.priv);
|
||||
tx = t.rlp();
|
||||
}
|
||||
cout << RLP(tx) << endl;
|
||||
s.execute(tx);
|
||||
|
||||
// TODO: Mine to set in stone.
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user