Tx ID calculation on broadcasting Hive transaction
This commit is contained in:
parent
a2c5c29005
commit
944fa3b072
4 changed files with 17 additions and 2 deletions
|
|
@ -7,6 +7,19 @@
|
||||||
|
|
||||||
namespace graphene { namespace peerplays_sidechain { namespace hive {
|
namespace graphene { namespace peerplays_sidechain { namespace hive {
|
||||||
|
|
||||||
|
digest_type transaction::digest() const {
|
||||||
|
digest_type::encoder enc;
|
||||||
|
fc::raw::pack(enc, *this);
|
||||||
|
return enc.result();
|
||||||
|
}
|
||||||
|
|
||||||
|
transaction_id_type transaction::id() const {
|
||||||
|
auto h = digest();
|
||||||
|
transaction_id_type result;
|
||||||
|
memcpy(result._hash, h._hash, std::min(sizeof(result), sizeof(h)));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
digest_type transaction::sig_digest(const chain_id_type &chain_id) const {
|
digest_type transaction::sig_digest(const chain_id_type &chain_id) const {
|
||||||
digest_type::encoder enc;
|
digest_type::encoder enc;
|
||||||
fc::raw::pack(enc, chain_id);
|
fc::raw::pack(enc, chain_id);
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,8 @@ struct transaction {
|
||||||
std::vector<hive_operation> operations;
|
std::vector<hive_operation> operations;
|
||||||
extensions_type extensions;
|
extensions_type extensions;
|
||||||
|
|
||||||
|
digest_type digest() const;
|
||||||
|
transaction_id_type id() const;
|
||||||
digest_type sig_digest(const chain_id_type &chain_id) const;
|
digest_type sig_digest(const chain_id_type &chain_id) const;
|
||||||
|
|
||||||
void set_expiration(fc::time_point_sec expiration_time);
|
void set_expiration(fc::time_point_sec expiration_time);
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ typedef fc::sha256 chain_id_type;
|
||||||
typedef std::string account_name_type;
|
typedef std::string account_name_type;
|
||||||
typedef fc::ripemd160 block_id_type;
|
typedef fc::ripemd160 block_id_type;
|
||||||
//typedef fc::ripemd160 checksum_type;
|
//typedef fc::ripemd160 checksum_type;
|
||||||
//typedef fc::ripemd160 transaction_id_type;
|
typedef fc::ripemd160 transaction_id_type;
|
||||||
typedef fc::sha256 digest_type;
|
typedef fc::sha256 digest_type;
|
||||||
typedef fc::ecc::compact_signature signature_type;
|
typedef fc::ecc::compact_signature signature_type;
|
||||||
//typedef safe<int64_t> share_type;
|
//typedef safe<int64_t> share_type;
|
||||||
|
|
|
||||||
|
|
@ -496,7 +496,7 @@ std::string sidechain_net_handler_hive::send_sidechain_transaction(const sidecha
|
||||||
// return "";
|
// return "";
|
||||||
// }
|
// }
|
||||||
|
|
||||||
return "";
|
return htrx.id().str();
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t sidechain_net_handler_hive::settle_sidechain_transaction(const sidechain_transaction_object &sto) {
|
int64_t sidechain_net_handler_hive::settle_sidechain_transaction(const sidechain_transaction_object &sto) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue