aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_basic/cryptonote_format_utils.cpp
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2021-03-20 01:33:10 -0400
committerluigi1111 <luigi1111w@gmail.com>2021-03-20 01:33:10 -0400
commit8d7c1135b8458db5a03e180e93f48a31b940b2f0 (patch)
treed30730a354559b16044c5cce4c5a779cf73b5b11 /src/cryptonote_basic/cryptonote_format_utils.cpp
parent0b6bfb1fd891a292179cdf0b181ab29b717fc72e (diff)
parent19b228393fdc0899104934538edfb0cfd665cdf0 (diff)
downloadmonzero-core-8d7c1135b8458db5a03e180e93f48a31b940b2f0.tar.gz
monzero-core-8d7c1135b8458db5a03e180e93f48a31b940b2f0.tar.xz
monzero-core-8d7c1135b8458db5a03e180e93f48a31b940b2f0.zip
Merge pull request #6810
19b2283 New add_aux_pow RPC to support merge mining (moneromooo-monero)
Diffstat (limited to 'src/cryptonote_basic/cryptonote_format_utils.cpp')
-rw-r--r--src/cryptonote_basic/cryptonote_format_utils.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/cryptonote_basic/cryptonote_format_utils.cpp b/src/cryptonote_basic/cryptonote_format_utils.cpp
index 1ef6590eb..3e4532d4e 100644
--- a/src/cryptonote_basic/cryptonote_format_utils.cpp
+++ b/src/cryptonote_basic/cryptonote_format_utils.cpp
@@ -727,6 +727,25 @@ namespace cryptonote
return true;
}
//---------------------------------------------------------------
+ bool add_mm_merkle_root_to_tx_extra(std::vector<uint8_t>& tx_extra, const crypto::hash& mm_merkle_root, size_t mm_merkle_tree_depth)
+ {
+ CHECK_AND_ASSERT_MES(mm_merkle_tree_depth < 32, false, "merge mining merkle tree depth should be less than 32");
+ size_t start_pos = tx_extra.size();
+ tx_extra.resize(tx_extra.size() + 3 + 32);
+ //write tag
+ tx_extra[start_pos] = TX_EXTRA_MERGE_MINING_TAG;
+ //write data size
+ ++start_pos;
+ tx_extra[start_pos] = 33;
+ //write depth varint (always one byte here)
+ ++start_pos;
+ tx_extra[start_pos] = mm_merkle_tree_depth;
+ //write data
+ ++start_pos;
+ memcpy(&tx_extra[start_pos], &mm_merkle_root, 32);
+ return true;
+ }
+ //---------------------------------------------------------------
bool remove_field_from_tx_extra(std::vector<uint8_t>& tx_extra, const std::type_info &type)
{
if (tx_extra.empty())