aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_basic/cryptonote_format_utils.cpp
diff options
context:
space:
mode:
authorJaquee <jaquee.monero@gmail.com>2017-08-04 19:05:35 +0200
committerJaquee <jaquee.monero@gmail.com>2017-10-15 17:32:09 +0200
commitfd773d88cde2160182d60b98e21cc8aabdc08a00 (patch)
tree883769b2fb9ce6e684e48cc571512b26346ed978 /src/cryptonote_basic/cryptonote_format_utils.cpp
parentlightwallet rpc server commands (diff)
downloadmonero-fd773d88cde2160182d60b98e21cc8aabdc08a00.tar.xz
refactor cryptonote_basic::add_tx_pub_key_to_extra
Diffstat (limited to 'src/cryptonote_basic/cryptonote_format_utils.cpp')
-rw-r--r--src/cryptonote_basic/cryptonote_format_utils.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/cryptonote_basic/cryptonote_format_utils.cpp b/src/cryptonote_basic/cryptonote_format_utils.cpp
index 6f171f227..d09f4c432 100644
--- a/src/cryptonote_basic/cryptonote_format_utils.cpp
+++ b/src/cryptonote_basic/cryptonote_format_utils.cpp
@@ -324,9 +324,19 @@ namespace cryptonote
//---------------------------------------------------------------
bool add_tx_pub_key_to_extra(transaction& tx, const crypto::public_key& tx_pub_key)
{
- tx.extra.resize(tx.extra.size() + 1 + sizeof(crypto::public_key));
- tx.extra[tx.extra.size() - 1 - sizeof(crypto::public_key)] = TX_EXTRA_TAG_PUBKEY;
- *reinterpret_cast<crypto::public_key*>(&tx.extra[tx.extra.size() - sizeof(crypto::public_key)]) = tx_pub_key;
+ return add_tx_pub_key_to_extra(tx.extra, tx_pub_key);
+ }
+ //---------------------------------------------------------------
+ bool add_tx_pub_key_to_extra(transaction_prefix& tx, const crypto::public_key& tx_pub_key)
+ {
+ return add_tx_pub_key_to_extra(tx.extra, tx_pub_key);
+ }
+ //---------------------------------------------------------------
+ bool add_tx_pub_key_to_extra(std::vector<uint8_t>& tx_extra, const crypto::public_key& tx_pub_key)
+ {
+ tx_extra.resize(tx_extra.size() + 1 + sizeof(crypto::public_key));
+ tx_extra[tx_extra.size() - 1 - sizeof(crypto::public_key)] = TX_EXTRA_TAG_PUBKEY;
+ *reinterpret_cast<crypto::public_key*>(&tx_extra[tx_extra.size() - sizeof(crypto::public_key)]) = tx_pub_key;
return true;
}
//---------------------------------------------------------------