Fix logging transactions that throw

This commit is contained in:
JoelKatz
2014-03-09 13:13:50 -07:00
committed by Nik Bougalis
parent b4593a274d
commit cf63b5c859
2 changed files with 13 additions and 9 deletions

View File

@@ -217,6 +217,15 @@ public:
return v.mData != mData;
}
std::string getHex () const
{
std::stringstream h;
h << std::hex << std::setfill ('0');
for (unsigned char const& element : mData)
h << std::setw (2) << element;
return h.str ();
}
// low-level VL length encode/decode functions
static Blob encodeVL (int length);
static int lengthVL (int length)

View File

@@ -1502,13 +1502,13 @@ private:
void recvTransaction (protocol::TMTransaction& packet)
{
Transaction::pointer tx;
Serializer s (packet.rawtransaction ());
#ifndef TRUST_NETWORK
try
{
#endif
Serializer s (packet.rawtransaction ());
SerializerIterator sit (s);
SerializedTransaction::pointer stx = boost::make_shared<SerializedTransaction> (boost::ref (sit));
uint256 txID = stx->getTransactionID();
@@ -1548,13 +1548,8 @@ private:
}
catch (...)
{
#ifdef BEAST_DEBUG
Log::out() << "Transaction from peer fails validity tests";
Json::StyledStreamWriter w;
// VFALCO NOTE This bypasses the Log bottleneck
w.write (std::cerr, tx->getJson (0));
#endif
return;
m_journal.warning << "Transaction invalid: " <<
s.getHex();
}
#endif
}