MUL-1227: signing serialize golos transaction#88
MUL-1227: signing serialize golos transaction#88PashaKlybik wants to merge 1 commit intoAppscrunch:masterfrom
Conversation
| encode(*m_signature, CODEC_HEX).c_str() | ||
| ); | ||
|
|
||
| std::cerr << buffer; |
| } | ||
|
|
||
| template <typename T> | ||
| GolosBinaryStream& write_as_binary(const T& data, GolosBinaryStream& stream) |
There was a problem hiding this comment.
Stream should be passed by pointer here and other non-operator<< functions.
|
|
||
| GolosBinaryStream& operator<<(GolosBinaryStream& stream, const std::time_t& time) | ||
| { | ||
| stream.write_data( |
There was a problem hiding this comment.
Is that intentional to omit explicit endianess of the time ?
| temp.insert(0, token_name); | ||
| temp.resize(7); | ||
| *stream << temp; | ||
| *stream << static_cast<uint8_t>(memo.size()); |
There was a problem hiding this comment.
It looks like we have a certain pattern of writing a string to a BinaryStream here, and it makes sense to move that to appropriate operator<<
| void write_to_stream(GolosBinaryStream* /*stream*/) const override | ||
| void write_to_stream(GolosBinaryStream* stream) const override | ||
| { | ||
| *stream << (uint8_t)0x02; // transfer_operation id |
There was a problem hiding this comment.
Make a named const out of this 0x02
| namespace internal | ||
| { | ||
|
|
||
| const BinaryDataPtr GOLOS_CHAIN_ID = decode("782a3039b478c839e4cb0c941ff4eaeb7df40bdd68bd441afd444b9da763de12", CODEC_HEX); |
There was a problem hiding this comment.
Please don't do that, you should make an array with bytes corresponding to this.
| *stream << amount.get_value_as_uint64(); | ||
| *stream << static_cast<uint8_t>(GOLOS_VALUE_DECIMAL_PLACES); | ||
|
|
||
| std::string temp (7, '\0'); |
There was a problem hiding this comment.
This looks silly, could you please explain what 7 stands for? also, this could be done much easier:
std::string normalized_token_name(token_name);
normalized_token_name.resize(7);
| : TransactionBase(blockchain_type), | ||
| GolosTransaction::GolosTransaction(const Account& account) | ||
| : TransactionBase(account.get_blockchain_type()), | ||
| m_account(account), |
There was a problem hiding this comment.
Account instance should not be locked for lifetime of transaction, please store the private key instead or add a transaction-level PropertyT for private key.
No description provided.