Browse Source

Fix for transactions.

cl-refactor
Gav Wood 11 years ago
parent
commit
b1d053e0cc
  1. 4
      libethereum/BlockChain.cpp
  2. 2
      libethereum/Common.h
  3. 6
      libethereum/Transaction.cpp

4
libethereum/BlockChain.cpp

@ -131,13 +131,13 @@ void BlockChain::import(bytes const& _block, Overlay const& _db)
throw AlreadyHaveBlock();
}
cnote << "Attempting import of " << newHash << "...";
cdebug << "Attempting import of " << newHash << "...";
// Work out its number as the parent's number + 1
auto pd = details(bi.parentHash);
if (!pd)
{
cwarn << " Unknown parent " << bi.parentHash;
cdebug << " Unknown parent " << bi.parentHash;
// We don't know the parent (yet) - discard for now. It'll get resent to us if we find out about its ancestry later on.
throw UnknownParent();
}

2
libethereum/Common.h

@ -169,7 +169,7 @@ struct LeftChannel: public LogChannel { static const char constexpr* name = "<<<
struct RightChannel: public LogChannel { static const char constexpr* name = ">>>"; };
struct WarnChannel: public LogChannel { static const char constexpr* name = "!!!"; static const int verbosity = 0; };
struct NoteChannel: public LogChannel { static const char constexpr* name = "***"; };
struct DebugChannel: public LogChannel { static const char constexpr* name = "---"; static const int verbosity = 0; };
struct DebugChannel: public LogChannel { static const char constexpr* name = "---"; static const int verbosity = 7; };
extern int g_logVerbosity;
extern std::function<void(std::string const&, char const*)> g_logPost;

6
libethereum/Transaction.cpp

@ -33,9 +33,9 @@ Transaction::Transaction(bytesConstRef _rlpData)
receiveAddress = rlp[1].toHash<Address>();
value = rlp[2].toInt<u256>();
data.reserve(rlp[3].itemCountStrict());
for (auto const& i: rlp[4])
for (auto const& i: rlp[3])
data.push_back(i.toInt<u256>());
vrs = Signature{ rlp[5].toInt<byte>(), rlp[6].toInt<u256>(), rlp[7].toInt<u256>() };
vrs = Signature{ rlp[4].toInt<byte>(), rlp[5].toInt<u256>(), rlp[6].toInt<u256>() };
}
Address Transaction::sender() const
@ -90,7 +90,7 @@ void Transaction::sign(Secret _priv)
void Transaction::fillStream(RLPStream& _s, bool _sig) const
{
_s.appendList(_sig ? 8 : 5);
_s.appendList(_sig ? 7 : 4);
_s << nonce << receiveAddress << value << data;
if (_sig)
_s << vrs.v << vrs.r << vrs.s;

Loading…
Cancel
Save