clang-format

This commit is contained in:
Vlad Dobromyslov 2022-08-26 11:09:55 +03:00
parent f780fa794f
commit ab7bb9e633
10 changed files with 183 additions and 242 deletions

View file

@ -7,8 +7,7 @@ namespace graphene { namespace peerplays_sidechain { namespace ethereum {
//! rlp_decoder //! rlp_decoder
namespace namespace {
{
const signed char p_util_hexdigit[256] = const signed char p_util_hexdigit[256] =
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
@ -28,21 +27,18 @@ const signed char p_util_hexdigit[256] =
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
} }
std::vector<std::string> rlp_decoder::decode(const std::string& str) std::vector<std::string> rlp_decoder::decode(const std::string &str) {
{
size_t consumed = 0; size_t consumed = 0;
const auto raw_vec = parse_hex(str); const auto raw_vec = parse_hex(str);
const std::vector<std::string> rlp_array = decode_rlp(raw_vec.data(), raw_vec.size(), consumed); const std::vector<std::string> rlp_array = decode_rlp(raw_vec.data(), raw_vec.size(), consumed);
std::vector<std::string> result_array; std::vector<std::string> result_array;
for(const auto& rlp : decode_rlp(raw_vec.data(), raw_vec.size(), consumed)) for (const auto &rlp : decode_rlp(raw_vec.data(), raw_vec.size(), consumed)) {
{
result_array.emplace_back(bytes2hex(rlp)); result_array.emplace_back(bytes2hex(rlp));
} }
return result_array; return result_array;
} }
std::vector<std::string> rlp_decoder::decode_rlp(const unsigned char *raw, size_t len, size_t& consumed) std::vector<std::string> rlp_decoder::decode_rlp(const unsigned char *raw, size_t len, size_t &consumed) {
{
std::vector<std::string> rlp_result; std::vector<std::string> rlp_result;
consumed = 0; consumed = 0;
@ -51,14 +47,12 @@ std::vector<std::string> rlp_decoder::decode_rlp(const unsigned char *raw, size_
const size_t prefixlen = 1; const size_t prefixlen = 1;
unsigned char ch = *raw; unsigned char ch = *raw;
if (len < 1) if (len < 1) {
{
return rlp_result; return rlp_result;
} }
// Case 1: [prefix is 1-byte data buffer] // Case 1: [prefix is 1-byte data buffer]
if (ch <= 0x7f) if (ch <= 0x7f) {
{
const unsigned char *tok_start = raw; const unsigned char *tok_start = raw;
const unsigned char *tok_end = tok_start + prefixlen; const unsigned char *tok_end = tok_start + prefixlen;
FC_ASSERT(tok_end <= end); FC_ASSERT(tok_end <= end);
@ -70,8 +64,7 @@ std::vector<std::string> rlp_decoder::decode_rlp(const unsigned char *raw, size_
consumed = buf.size(); consumed = buf.size();
} }
// Case 2: [prefix, including buffer length][data] // Case 2: [prefix, including buffer length][data]
else if ((ch >= 0x80) && (ch <= 0xb7)) else if ((ch >= 0x80) && (ch <= 0xb7)) {
{
const size_t blen = ch - 0x80; const size_t blen = ch - 0x80;
const size_t expected = prefixlen + blen; const size_t expected = prefixlen + blen;
@ -93,8 +86,7 @@ std::vector<std::string> rlp_decoder::decode_rlp(const unsigned char *raw, size_
consumed = expected; consumed = expected;
} }
// Case 3: [prefix][buffer length][data] // Case 3: [prefix][buffer length][data]
else if ((ch >= 0xb8) && (ch <= 0xbf)) else if ((ch >= 0xb8) && (ch <= 0xbf)) {
{
const size_t uintlen = ch - 0xb7; const size_t uintlen = ch - 0xb7;
size_t expected = prefixlen + uintlen; size_t expected = prefixlen + uintlen;
@ -124,8 +116,7 @@ std::vector<std::string> rlp_decoder::decode_rlp(const unsigned char *raw, size_
consumed = expected; consumed = expected;
} }
// Case 4: [prefix][list] // Case 4: [prefix][list]
else if ((ch >= 0xc0) && (ch <= 0xf7)) else if ((ch >= 0xc0) && (ch <= 0xf7)) {
{
const size_t payloadlen = ch - 0xc0; const size_t payloadlen = ch - 0xc0;
const size_t expected = prefixlen + payloadlen; const size_t expected = prefixlen + payloadlen;
@ -136,8 +127,7 @@ std::vector<std::string> rlp_decoder::decode_rlp(const unsigned char *raw, size_
consumed = expected; consumed = expected;
} }
// Case 5: [prefix][list length][list] // Case 5: [prefix][list length][list]
else else {
{
FC_ASSERT((ch >= 0xf8) && (ch <= 0xff)); FC_ASSERT((ch >= 0xf8) && (ch <= 0xff));
const size_t uintlen = ch - 0xf7; const size_t uintlen = ch - 0xf7;
@ -169,8 +159,7 @@ std::vector<std::string> rlp_decoder::decode_rlp(const unsigned char *raw, size_
return rlp_result; return rlp_result;
} }
std::vector<std::string> rlp_decoder::decode_array(const unsigned char *raw, size_t len, size_t uintlen, size_t payloadlen) std::vector<std::string> rlp_decoder::decode_array(const unsigned char *raw, size_t len, size_t uintlen, size_t payloadlen) {
{
std::vector<std::string> rlp_result; std::vector<std::string> rlp_result;
const size_t prefixlen = 1; const size_t prefixlen = 1;
@ -183,8 +172,7 @@ std::vector<std::string> rlp_decoder::decode_array(const unsigned char *raw, siz
const unsigned char *list_ent = raw + prefixlen + uintlen; const unsigned char *list_ent = raw + prefixlen + uintlen;
// recursively read until payloadlen bytes parsed, or error // recursively read until payloadlen bytes parsed, or error
while (child_len > 0) while (child_len > 0) {
{
size_t child_consumed = 0; size_t child_consumed = 0;
const auto val = decode_rlp(list_ent, child_len, child_consumed); const auto val = decode_rlp(list_ent, child_len, child_consumed);
@ -197,8 +185,7 @@ std::vector<std::string> rlp_decoder::decode_array(const unsigned char *raw, siz
return rlp_result; return rlp_result;
} }
uint64_t rlp_decoder::to_int(const unsigned char *raw, size_t len) uint64_t rlp_decoder::to_int(const unsigned char *raw, size_t len) {
{
if (len == 0) if (len == 0)
return 0; return 0;
else if (len == 1) else if (len == 1)
@ -207,17 +194,14 @@ uint64_t rlp_decoder::to_int(const unsigned char *raw, size_t len)
return (raw[len - 1]) + (to_int(raw, len - 1) * 256); return (raw[len - 1]) + (to_int(raw, len - 1) * 256);
} }
std::vector<unsigned char> rlp_decoder::parse_hex(const std::string& str) std::vector<unsigned char> rlp_decoder::parse_hex(const std::string &str) {
{
return parse_hex(str.c_str()); return parse_hex(str.c_str());
} }
std::vector<unsigned char> rlp_decoder::parse_hex(const char* psz) std::vector<unsigned char> rlp_decoder::parse_hex(const char *psz) {
{
// convert hex dump to vector // convert hex dump to vector
std::vector<unsigned char> vch; std::vector<unsigned char> vch;
while (true) while (true) {
{
while (isspace(*psz)) while (isspace(*psz))
psz++; psz++;
signed char c = hex_digit(*psz++); signed char c = hex_digit(*psz++);
@ -233,8 +217,7 @@ std::vector<unsigned char> rlp_decoder::parse_hex(const char* psz)
return vch; return vch;
} }
signed char rlp_decoder::hex_digit(char c) signed char rlp_decoder::hex_digit(char c) {
{
return p_util_hexdigit[(unsigned char)c]; return p_util_hexdigit[(unsigned char)c];
} }

View file

@ -1,41 +1,35 @@
#include <graphene/peerplays_sidechain/ethereum/encoders.hpp> #include <graphene/peerplays_sidechain/ethereum/encoders.hpp>
#include <stdlib.h>
#include <boost/algorithm/hex.hpp> #include <boost/algorithm/hex.hpp>
#include <boost/format.hpp> #include <boost/format.hpp>
#include <stdlib.h>
#include <graphene/peerplays_sidechain/ethereum/utils.hpp> #include <graphene/peerplays_sidechain/ethereum/utils.hpp>
namespace graphene { namespace peerplays_sidechain { namespace ethereum { namespace graphene { namespace peerplays_sidechain { namespace ethereum {
//! base_encoder //! base_encoder
std::string base_encoder::encode_uint256(boost::multiprecision::uint256_t value) std::string base_encoder::encode_uint256(boost::multiprecision::uint256_t value) {
{
return (boost::format("%x") % boost::io::group(std::setw(64), std::setfill('0'), value)).str(); return (boost::format("%x") % boost::io::group(std::setw(64), std::setfill('0'), value)).str();
} }
std::string base_encoder::encode_address(const std::string& value) std::string base_encoder::encode_address(const std::string &value) {
{
return (boost::format("%x") % boost::io::group(std::setw(64), std::setfill('0'), value)).str(); return (boost::format("%x") % boost::io::group(std::setw(64), std::setfill('0'), value)).str();
} }
std::string base_encoder::encode_string(const std::string& value) std::string base_encoder::encode_string(const std::string &value) {
{
std::string data = (boost::format("%x") % boost::io::group(std::setw(64), std::setfill('0'), value.size())).str(); std::string data = (boost::format("%x") % boost::io::group(std::setw(64), std::setfill('0'), value.size())).str();
data += boost::algorithm::hex(value) + std::string((64 - value.size() * 2 % 64), '0'); data += boost::algorithm::hex(value) + std::string((64 - value.size() * 2 % 64), '0');
return data; return data;
} }
//! update_owners_encoder //! update_owners_encoder
std::string update_owners_encoder::encode(const std::vector<std::pair<std::string, uint16_t>>& owners_weights, const std::string& object_id) const std::string update_owners_encoder::encode(const std::vector<std::pair<std::string, uint16_t>> &owners_weights, const std::string &object_id) const {
{
std::string data = "0x" + function_signature; std::string data = "0x" + function_signature;
data += base_encoder::encode_uint256(64); data += base_encoder::encode_uint256(64);
data += base_encoder::encode_uint256((owners_weights.size() * 2 + 3) * 32); data += base_encoder::encode_uint256((owners_weights.size() * 2 + 3) * 32);
data += base_encoder::encode_uint256(owners_weights.size()); data += base_encoder::encode_uint256(owners_weights.size());
for(const auto& owner : owners_weights) for (const auto &owner : owners_weights) {
{
data += base_encoder::encode_address(owner.first); data += base_encoder::encode_address(owner.first);
data += base_encoder::encode_uint256(owner.second); data += base_encoder::encode_uint256(owner.second);
} }
@ -45,8 +39,7 @@ std::string update_owners_encoder::encode(const std::vector<std::pair<std::strin
} }
//! withdrawal_encoder //! withdrawal_encoder
std::string withdrawal_encoder::encode(const std::string& to, boost::multiprecision::uint256_t amount, const std::string& object_id) const std::string withdrawal_encoder::encode(const std::string &to, boost::multiprecision::uint256_t amount, const std::string &object_id) const {
{
std::string data = "0x" + function_signature; std::string data = "0x" + function_signature;
data += base_encoder::encode_address(to); data += base_encoder::encode_address(to);
data += base_encoder::encode_uint256(amount); data += base_encoder::encode_uint256(amount);
@ -56,23 +49,17 @@ std::string withdrawal_encoder::encode(const std::string& to, boost::multiprecis
return data; return data;
} }
//! rlp_encoder //! rlp_encoder
std::string rlp_encoder::encode(const std::string& s) std::string rlp_encoder::encode(const std::string &s) {
{
return encode_rlp(hex2bytes(s)); return encode_rlp(hex2bytes(s));
} }
std::string rlp_encoder::encode_length(int len, int offset) std::string rlp_encoder::encode_length(int len, int offset) {
{ if (len < 56) {
if(len<56)
{
std::string temp; std::string temp;
temp = (char)(len + offset); temp = (char)(len + offset);
return temp; return temp;
} } else {
else
{
const std::string hexLength = to_hex(len); const std::string hexLength = to_hex(len);
const int lLength = hexLength.size() / 2; const int lLength = hexLength.size() / 2;
const std::string fByte = to_hex(offset + 55 + lLength); const std::string fByte = to_hex(offset + 55 + lLength);
@ -80,24 +67,21 @@ std::string rlp_encoder::encode_length(int len, int offset)
} }
} }
std::string rlp_encoder::hex2bytes(const std::string& s) std::string rlp_encoder::hex2bytes(const std::string &s) {
{
std::string dest; std::string dest;
dest.resize(s.size() / 2); dest.resize(s.size() / 2);
hex2bin(s.c_str(), &dest[0]); hex2bin(s.c_str(), &dest[0]);
return dest; return dest;
} }
std::string rlp_encoder::encode_rlp(const std::string& s) std::string rlp_encoder::encode_rlp(const std::string &s) {
{
if (s.size() == 1 && (unsigned char)s[0] < 128) if (s.size() == 1 && (unsigned char)s[0] < 128)
return s; return s;
else else
return encode_length(s.size(), 128) + s; return encode_length(s.size(), 128) + s;
} }
int rlp_encoder::char2int(char input) int rlp_encoder::char2int(char input) {
{
if (input >= '0' && input <= '9') if (input >= '0' && input <= '9')
return input - '0'; return input - '0';
if (input >= 'A' && input <= 'F') if (input >= 'A' && input <= 'F')
@ -108,10 +92,8 @@ int rlp_encoder::char2int(char input)
return -1; return -1;
} }
void rlp_encoder::hex2bin(const char* src, char* target) void rlp_encoder::hex2bin(const char *src, char *target) {
{ while (*src && src[1]) {
while(*src && src[1])
{
*(target++) = char2int(*src) * 16 + char2int(src[1]); *(target++) = char2int(*src) * 16 + char2int(src[1]);
src += 2; src += 2;
} }

View file

@ -10,14 +10,13 @@
#include <fc/crypto/elliptic.hpp> #include <fc/crypto/elliptic.hpp>
#include <fc/crypto/hex.hpp> #include <fc/crypto/hex.hpp>
#include <graphene/peerplays_sidechain/ethereum/encoders.hpp>
#include <graphene/peerplays_sidechain/ethereum/decoders.hpp> #include <graphene/peerplays_sidechain/ethereum/decoders.hpp>
#include <graphene/peerplays_sidechain/ethereum/encoders.hpp>
#include <graphene/peerplays_sidechain/ethereum/types.hpp> #include <graphene/peerplays_sidechain/ethereum/types.hpp>
#include <graphene/peerplays_sidechain/ethereum/utils.hpp> #include <graphene/peerplays_sidechain/ethereum/utils.hpp>
namespace graphene { namespace peerplays_sidechain { namespace ethereum { namespace graphene { namespace peerplays_sidechain { namespace ethereum {
const secp256k1_context *eth_context() { const secp256k1_context *eth_context() {
static secp256k1_context *ctx = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY | SECP256K1_CONTEXT_SIGN); static secp256k1_context *ctx = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY | SECP256K1_CONTEXT_SIGN);
return ctx; return ctx;
@ -25,13 +24,11 @@ const secp256k1_context *eth_context() {
//! transaction //! transaction
const transaction& transaction::sign(const std::string& private_key) const const transaction &transaction::sign(const std::string &private_key) const {
{
return *this; return *this;
} }
std::string transaction::serialize() const std::string transaction::serialize() const {
{
boost::property_tree::ptree pt; boost::property_tree::ptree pt;
pt.put("from", from); pt.put("from", from);
pt.put("to", to); pt.put("to", to);
@ -42,8 +39,7 @@ std::string transaction::serialize() const
return ss.str(); return ss.str();
} }
void transaction::deserialize(const std::string& raw_tx) void transaction::deserialize(const std::string &raw_tx) {
{
std::stringstream ss_tx(raw_tx); std::stringstream ss_tx(raw_tx);
boost::property_tree::ptree tx_json; boost::property_tree::ptree tx_json;
boost::property_tree::read_json(ss_tx, tx_json); boost::property_tree::read_json(ss_tx, tx_json);
@ -58,8 +54,7 @@ void transaction::deserialize(const std::string& raw_tx)
//! raw_transaction //! raw_transaction
signed_transaction raw_transaction::sign(const std::string& private_key) const signed_transaction raw_transaction::sign(const std::string &private_key) const {
{
//! Prepare signed transaction //! Prepare signed transaction
signed_transaction tr; signed_transaction tr;
tr.nonce = nonce; tr.nonce = nonce;
@ -98,8 +93,7 @@ signed_transaction raw_transaction::sign(const std::string& private_key) const
return tr; return tr;
} }
std::string raw_transaction::serialize() const std::string raw_transaction::serialize() const {
{
rlp_encoder encoder; rlp_encoder encoder;
const std::string serialized = encoder.encode(remove_0x(nonce)) + const std::string serialized = encoder.encode(remove_0x(nonce)) +
encoder.encode(remove_0x(gas_price)) + encoder.encode(remove_0x(gas_price)) +
@ -114,8 +108,7 @@ std::string raw_transaction::serialize() const
return add_0x(bytes2hex(encoder.encode_length(serialized.size(), 192) + serialized)); return add_0x(bytes2hex(encoder.encode_length(serialized.size(), 192) + serialized));
} }
void raw_transaction::deserialize(const std::string& raw_tx) void raw_transaction::deserialize(const std::string &raw_tx) {
{
rlp_decoder decoder; rlp_decoder decoder;
const auto rlp_array = decoder.decode(remove_0x(raw_tx)); const auto rlp_array = decoder.decode(remove_0x(raw_tx));
FC_ASSERT(rlp_array.size() >= 7, "Wrong rlp format"); FC_ASSERT(rlp_array.size() >= 7, "Wrong rlp format");
@ -131,8 +124,7 @@ void raw_transaction::deserialize(const std::string& raw_tx)
//! signed_transaction //! signed_transaction
std::string signed_transaction::serialize() const std::string signed_transaction::serialize() const {
{
rlp_encoder encoder; rlp_encoder encoder;
const std::string serialized = encoder.encode(remove_0x(nonce)) + const std::string serialized = encoder.encode(remove_0x(nonce)) +
encoder.encode(remove_0x(gas_price)) + encoder.encode(remove_0x(gas_price)) +
@ -147,8 +139,7 @@ std::string signed_transaction::serialize() const
return add_0x(bytes2hex(encoder.encode_length(serialized.size(), 192) + serialized)); return add_0x(bytes2hex(encoder.encode_length(serialized.size(), 192) + serialized));
} }
void signed_transaction::deserialize(const std::string& raw_tx) void signed_transaction::deserialize(const std::string &raw_tx) {
{
rlp_decoder decoder; rlp_decoder decoder;
const auto rlp_array = decoder.decode(remove_0x(raw_tx)); const auto rlp_array = decoder.decode(remove_0x(raw_tx));
FC_ASSERT(rlp_array.size() >= 9, "Wrong rlp format"); FC_ASSERT(rlp_array.size() >= 9, "Wrong rlp format");

View file

@ -10,8 +10,7 @@ bytes parse_hex(const std::string &str) {
return vec; return vec;
} }
std::string bytes2hex(const std::string& s) std::string bytes2hex(const std::string &s) {
{
std::string dest; std::string dest;
for (const auto &i : s) for (const auto &i : s)
dest += uchar2Hex((unsigned char)i); dest += uchar2Hex((unsigned char)i);
@ -19,14 +18,12 @@ std::string bytes2hex(const std::string& s)
return dest; return dest;
} }
std::string uchar2Hex(unsigned char n) std::string uchar2Hex(unsigned char n) {
{
std::string dest; std::string dest;
dest.resize(2); dest.resize(2);
sprintf(&dest[0], "%X", n); sprintf(&dest[0], "%X", n);
if(n < (unsigned char)16) if (n < (unsigned char)16) {
{
dest[1] = dest[0]; dest[1] = dest[0];
dest[0] = '0'; dest[0] = '0';
} }
@ -34,8 +31,7 @@ std::string uchar2Hex(unsigned char n)
return dest; return dest;
} }
std::string add_0x(const std::string& s) std::string add_0x(const std::string &s) {
{
if (s.size() > 1) { if (s.size() > 1) {
if (s.substr(0, 2) == "0x") if (s.substr(0, 2) == "0x")
return s; return s;
@ -44,8 +40,7 @@ std::string add_0x(const std::string& s)
return "0x" + s; return "0x" + s;
} }
std::string remove_0x(const std::string& s) std::string remove_0x(const std::string &s) {
{
if (s.size() > 1) { if (s.size() > 1) {
if (s.substr(0, 2) == "0x") if (s.substr(0, 2) == "0x")
return s.substr(2); return s.substr(2);

View file

@ -7,8 +7,7 @@ namespace graphene { namespace peerplays_sidechain { namespace ethereum {
class rlp_decoder { class rlp_decoder {
private: private:
enum RLP_constants enum RLP_constants {
{
RLP_maxUintLen = 8, RLP_maxUintLen = 8,
RLP_bufferLenStart = 0x80, RLP_bufferLenStart = 0x80,
RLP_listStart = 0xc0, RLP_listStart = 0xc0,

View file

@ -1,8 +1,8 @@
#pragma once #pragma once
#include <boost/multiprecision/cpp_int.hpp>
#include <string> #include <string>
#include <vector> #include <vector>
#include <boost/multiprecision/cpp_int.hpp>
namespace graphene { namespace peerplays_sidechain { namespace ethereum { namespace graphene { namespace peerplays_sidechain { namespace ethereum {

View file

@ -6,14 +6,12 @@
namespace graphene { namespace peerplays_sidechain { namespace ethereum { namespace graphene { namespace peerplays_sidechain { namespace ethereum {
class base_transaction class base_transaction {
{
virtual std::string serialize() const = 0; virtual std::string serialize() const = 0;
virtual void deserialize(const std::string &raw_tx) = 0; virtual void deserialize(const std::string &raw_tx) = 0;
}; };
class transaction : base_transaction class transaction : base_transaction {
{
public: public:
std::string from; std::string from;
std::string to; std::string to;
@ -26,8 +24,7 @@ public:
}; };
class signed_transaction; class signed_transaction;
class raw_transaction : base_transaction class raw_transaction : base_transaction {
{
public: public:
std::string nonce; std::string nonce;
std::string gas_price; std::string gas_price;
@ -43,8 +40,7 @@ public:
virtual void deserialize(const std::string &raw_tx) override; virtual void deserialize(const std::string &raw_tx) override;
}; };
class signed_transaction : base_transaction class signed_transaction : base_transaction {
{
public: public:
std::string nonce; std::string nonce;
std::string gas_price; std::string gas_price;

View file

@ -15,8 +15,7 @@ std::string add_0x(const std::string& s);
std::string remove_0x(const std::string &s); std::string remove_0x(const std::string &s);
template <typename T> template <typename T>
std::string to_hex( const T& val ) std::string to_hex(const T &val) {
{
std::stringstream stream; std::stringstream stream;
stream << std::hex << val; stream << std::hex << val;
std::string result(stream.str()); std::string result(stream.str());
@ -26,8 +25,7 @@ std::string to_hex( const T& val )
} }
template <typename T> template <typename T>
T from_hex( const std::string& s ) T from_hex(const std::string &s) {
{
T val; T val;
std::stringstream stream; std::stringstream stream;
stream << std::hex << s; stream << std::hex << s;

View file

@ -557,8 +557,7 @@ std::string sidechain_net_handler_ethereum::send_sidechain_transaction(const sid
node.put("transaction", transaction); node.put("transaction", transaction);
node.put("transaction_receipt", tx_json.get<std::string>("result")); node.put("transaction_receipt", tx_json.get<std::string>("result"));
pt_array.push_back(std::make_pair("", node)); pt_array.push_back(std::make_pair("", node));
} } else {
else {
//! Fixme //! Fixme
//! How should we proceed with error in eth_send_transaction //! How should we proceed with error in eth_send_transaction
elog("Error in eth_send_transaction for transaction ${id}, transaction ${transaction}", ("id", sto.id)("transaction", transaction)); elog("Error in eth_send_transaction for transaction ${id}, transaction ${transaction}", ("id", sto.id)("transaction", transaction));
@ -593,8 +592,7 @@ bool sidechain_net_handler_ethereum::settle_sidechain_transaction(const sidechai
return false; return false;
} }
if( "0x1" == json_receipt.get<std::string>("result.status") ) if ("0x1" == json_receipt.get<std::string>("result.status")) {
{
count += 1; count += 1;
//! Fixme - compare data somehow? //! Fixme - compare data somehow?
//if( sto.transaction == entry_receipt.second.get<std::string>("data") ) { //if( sto.transaction == entry_receipt.second.get<std::string>("data") ) {
@ -606,8 +604,7 @@ bool sidechain_net_handler_ethereum::settle_sidechain_transaction(const sidechai
if (count != json.get_child("result_array").size()) { if (count != json.get_child("result_array").size()) {
wlog("Not all receipts received for transaction ${id}", ("id", sto.id)); wlog("Not all receipts received for transaction ${id}", ("id", sto.id));
return false; return false;
} } else
else
return true; return true;
return false; return false;