Browse Source

Transaction documentation and build fixes.

cl-refactor
Gav Wood 10 years ago
parent
commit
d5d81ea5c8
  1. 4
      alethzero/MainWin.cpp
  2. 2
      libethereum/State.cpp
  3. 16
      test/crypto.cpp

4
alethzero/MainWin.cpp

@ -946,7 +946,7 @@ static bool blockMatch(string const& _f, dev::eth::BlockDetails const& _b, h256
static bool transactionMatch(string const& _f, Transaction const& _t) static bool transactionMatch(string const& _f, Transaction const& _t)
{ {
string info = toHex(_t.receiveAddress().ref()) + " " + toHex(_t.sha3(true).ref()) + " " + toHex(_t.sha3(false).ref()) + " " + toHex(_t.sender().ref()); string info = toHex(_t.receiveAddress().ref()) + " " + toHex(_t.sha3().ref()) + " " + toHex(_t.sha3(eth::WithoutSignature).ref()) + " " + toHex(_t.sender().ref());
if (info.find(_f) != string::npos) if (info.find(_f) != string::npos)
return true; return true;
return false; return false;
@ -1266,7 +1266,7 @@ void Main::on_blocks_currentItemChanged()
s << "<br/>V: <b>" << hex << nouppercase << (int)tx.signature().v << "</b>"; s << "<br/>V: <b>" << hex << nouppercase << (int)tx.signature().v << "</b>";
s << "<br/>R: <b>" << hex << nouppercase << tx.signature().r << "</b>"; s << "<br/>R: <b>" << hex << nouppercase << tx.signature().r << "</b>";
s << "<br/>S: <b>" << hex << nouppercase << tx.signature().s << "</b>"; s << "<br/>S: <b>" << hex << nouppercase << tx.signature().s << "</b>";
s << "<br/>Msg: <b>" << tx.sha3(false) << "</b>"; s << "<br/>Msg: <b>" << tx.sha3(eth::WithoutSignature) << "</b>";
if (tx.isCreation()) if (tx.isCreation())
{ {
if (tx.data().size()) if (tx.data().size())

2
libethereum/State.cpp

@ -1126,7 +1126,7 @@ u256 State::execute(bytesConstRef _rlp, bytes* o_output, bool _commit)
#if ETH_PARANOIA #if ETH_PARANOIA
ctrace << "Executing" << e.t() << "on" << h; ctrace << "Executing" << e.t() << "on" << h;
ctrace << toHex(e.t().rlp(true)); ctrace << toHex(e.t().rlp());
#endif #endif
e.go(); e.go();

16
test/crypto.cpp

@ -340,14 +340,14 @@ BOOST_AUTO_TEST_CASE(eth_keypairs)
BOOST_REQUIRE(p.address() == Address(fromHex("8a40bfaa73256b60764c1bf40675a99083efb075"))); BOOST_REQUIRE(p.address() == Address(fromHex("8a40bfaa73256b60764c1bf40675a99083efb075")));
{ {
eth::Transaction t(1000, 0, 0, h160(fromHex("944400f4b88ac9589a0f17ed4671da26bddb668b")), bytes(), 0, p.secret()); eth::Transaction t(1000, 0, 0, h160(fromHex("944400f4b88ac9589a0f17ed4671da26bddb668b")), bytes(), 0, p.secret());
auto rlp = t.rlp(false); auto rlp = t.rlp(eth::WithoutSignature);
cnote << RLP(rlp); cnote << RLP(rlp);
cnote << toHex(rlp); cnote << toHex(rlp);
cnote << t.sha3(false); cnote << t.sha3(eth::WithoutSignature);
rlp = t.rlp(true); rlp = t.rlp(eth::WithSignature);
cnote << RLP(rlp); cnote << RLP(rlp);
cnote << toHex(rlp); cnote << toHex(rlp);
cnote << t.sha3(true); cnote << t.sha3(eth::WithSignature);
BOOST_REQUIRE(t.sender() == p.address()); BOOST_REQUIRE(t.sender() == p.address());
} }
@ -364,14 +364,14 @@ int cryptoTest()
assert(p.address() == Address(fromHex("8a40bfaa73256b60764c1bf40675a99083efb075"))); assert(p.address() == Address(fromHex("8a40bfaa73256b60764c1bf40675a99083efb075")));
{ {
eth::Transaction t(1000, 0, 0, h160(fromHex("944400f4b88ac9589a0f17ed4671da26bddb668b")), bytes(), 0, p.secret()); eth::Transaction t(1000, 0, 0, h160(fromHex("944400f4b88ac9589a0f17ed4671da26bddb668b")), bytes(), 0, p.secret());
auto rlp = t.rlp(false); auto rlp = t.rlp(eth::WithoutSignature);
cnote << RLP(rlp); cnote << RLP(rlp);
cnote << toHex(rlp); cnote << toHex(rlp);
cnote << t.sha3(false); cnote << t.sha3(eth::WithoutSignature);
rlp = t.rlp(true); rlp = t.rlp(eth::WithSignature);
cnote << RLP(rlp); cnote << RLP(rlp);
cnote << toHex(rlp); cnote << toHex(rlp);
cnote << t.sha3(true); cnote << t.sha3(eth::WithSignature);
assert(t.sender() == p.address()); assert(t.sender() == p.address());
} }

Loading…
Cancel
Save