diff --git a/src/daemon/MoneroDaemonModel.cpp b/src/daemon/MoneroDaemonModel.cpp index 2db6e68..3a9b997 100644 --- a/src/daemon/MoneroDaemonModel.cpp +++ b/src/daemon/MoneroDaemonModel.cpp @@ -99,7 +99,7 @@ namespace monero { if (majorVersion != boost::none) node.put("majorVersion", *majorVersion); if (minorVersion != boost::none) node.put("minorVersion", *minorVersion); if (nonce != boost::none) node.put("nonce", *nonce); - if (coinbaseTxId != boost::none) node.put("coinbaseTxId", *coinbaseTxId); + if (minerTxId != boost::none) node.put("minerTxId", *minerTxId); if (numTxs != boost::none) node.put("numTxs", *numTxs); if (orphanStatus != boost::none) node.put("orphanStatus", *orphanStatus); if (prevId != boost::none) node.put("prevId", *prevId); @@ -123,7 +123,7 @@ namespace monero { majorVersion = MoneroUtils::reconcile(majorVersion, other->majorVersion, "majorVersion"); minorVersion = MoneroUtils::reconcile(minorVersion, other->minorVersion, "minorVersion"); nonce = MoneroUtils::reconcile(nonce, other->nonce, "nonce"); - coinbaseTxId = MoneroUtils::reconcile(coinbaseTxId, other->coinbaseTxId); + minerTxId = MoneroUtils::reconcile(minerTxId, other->minerTxId); numTxs = MoneroUtils::reconcile(numTxs, other->numTxs, "block header numTxs"); orphanStatus = MoneroUtils::reconcile(orphanStatus, other->orphanStatus); prevId = MoneroUtils::reconcile(prevId, other->prevId); @@ -136,7 +136,7 @@ namespace monero { boost::property_tree::ptree MoneroBlock::toPropertyTree() const { boost::property_tree::ptree node = MoneroBlockHeader::toPropertyTree(); if (hex != boost::none) node.put("hex", *hex); - if (coinbaseTx != boost::none) node.add_child("coinbaseTx", (*coinbaseTx)->toPropertyTree()); + if (minerTx != boost::none) node.add_child("minerTx", (*minerTx)->toPropertyTree()); if (!txs.empty()) node.add_child("txs", MoneroUtils::toPropertyTree(txs)); if (!txIds.empty()) node.add_child("txIds", MoneroUtils::toPropertyTree(txIds)); return node; @@ -157,14 +157,14 @@ namespace monero { hex = MoneroUtils::reconcile(hex, other->hex); txIds = MoneroUtils::reconcile(txIds, other->txIds); - // merge coinbase tx - if (coinbaseTx == boost::none) coinbaseTx = other->coinbaseTx; - if (other->coinbaseTx != boost::none) { - other->coinbaseTx.get()->block = self; - coinbaseTx.get()->merge(coinbaseTx.get(), other->coinbaseTx.get()); + // merge miner tx + if (minerTx == boost::none) minerTx = other->minerTx; + if (other->minerTx != boost::none) { + other->minerTx.get()->block = self; + minerTx.get()->merge(minerTx.get(), other->minerTx.get()); } - // merge non-coinbase txs + // merge non-miner txs if (!other->txs.empty()) { for (const shared_ptr otherTx : other->txs) { // NOTE: not using reference so shared_ptr is not deleted when block is dereferenced otherTx->block = self; @@ -179,7 +179,7 @@ namespace monero { MTRACE("MoneroTx::copy(const shared_ptr& src, const shared_ptr& tgt)"); tgt->id = src->id; tgt->version = src->version; - tgt->isCoinbase = src->isCoinbase; + tgt->isMinerTx = src->isMinerTx; tgt->paymentId = src->paymentId; tgt->fee = src->fee; tgt->mixin = src->mixin; @@ -235,7 +235,7 @@ namespace monero { boost::property_tree::ptree node; if (id != boost::none) node.put("id", *id); if (version != boost::none) node.put("version", *version); - if (isCoinbase != boost::none) node.put("isCoinbase", *isCoinbase); + if (isMinerTx != boost::none) node.put("isMinerTx", *isMinerTx); if (paymentId != boost::none) node.put("paymentId", *paymentId); if (fee != boost::none) node.put("fee", *fee); if (mixin != boost::none) node.put("mixin", *mixin); diff --git a/src/daemon/MoneroDaemonModel.h b/src/daemon/MoneroDaemonModel.h index 1e13554..3fe4abb 100644 --- a/src/daemon/MoneroDaemonModel.h +++ b/src/daemon/MoneroDaemonModel.h @@ -125,7 +125,7 @@ namespace monero { boost::optional majorVersion; boost::optional minorVersion; boost::optional nonce; - boost::optional coinbaseTxId; + boost::optional minerTxId; boost::optional numTxs; boost::optional orphanStatus; boost::optional prevId; @@ -141,7 +141,7 @@ namespace monero { */ struct MoneroBlock : public MoneroBlockHeader { boost::optional hex; - boost::optional> coinbaseTx; + boost::optional> minerTx; vector> txs; vector txIds; @@ -158,7 +158,7 @@ namespace monero { boost::optional> block; boost::optional id; boost::optional version; - boost::optional isCoinbase; + boost::optional isMinerTx; boost::optional paymentId; boost::optional fee; boost::optional mixin; diff --git a/src/utils/MoneroUtils.cpp b/src/utils/MoneroUtils.cpp index f752c85..0ca129b 100644 --- a/src/utils/MoneroUtils.cpp +++ b/src/utils/MoneroUtils.cpp @@ -153,7 +153,7 @@ void nodeToTx(const boost::property_tree::ptree& node, shared_ptr tx) string key = it->first; if (key == string("id")) tx->id = it->second.data(); else if (key == string("version")) throw runtime_error("version deserializationn not implemented"); - else if (key == string("isCoinbase")) tx->isCoinbase = it->second.get_value(); + else if (key == string("isMinerTx")) tx->isMinerTx = it->second.get_value(); else if (key == string("paymentId")) throw runtime_error("paymentId deserializationn not implemented"); else if (key == string("fee")) throw runtime_error("fee deserialization not implemented"); else if (key == string("mixin")) throw runtime_error("mixin deserialization not implemented"); @@ -500,7 +500,7 @@ shared_ptr MoneroUtils::cnBlockToBlock(const cryptonote::block& cnB block->timestamp = cnBlock.timestamp; block->prevId = epee::string_tools::pod_to_hex(cnBlock.prev_id); block->nonce = cnBlock.nonce; - block->coinbaseTx = MoneroUtils::cnTxToTx(cnBlock.miner_tx); + block->minerTx = MoneroUtils::cnTxToTx(cnBlock.miner_tx); for (const crypto::hash& txHash : cnBlock.tx_hashes) { block->txIds.push_back(epee::string_tools::pod_to_hex(txHash)); } @@ -517,7 +517,7 @@ shared_ptr MoneroUtils::cnTxToTx(const cryptonote::transaction& cnTx, // init vins for (const txin_v& cnVin : cnTx.vin) { if (cnVin.which() != 0 && cnVin.which() != 3) throw runtime_error("Unsupported variant type"); - if (tx->isCoinbase == boost::none) tx->isCoinbase = cnVin.which() == 0; + if (tx->isMinerTx == boost::none) tx->isMinerTx = cnVin.which() == 0; if (cnVin.which() != 3) continue; // only process txin_to_key of variant TODO: support other types, like 0 "gen" which is miner tx? shared_ptr vin = initAsTxWallet ? make_shared() : make_shared(); vin->tx = tx; diff --git a/src/wallet/MoneroWallet.cpp b/src/wallet/MoneroWallet.cpp index a205587..c31b6f8 100644 --- a/src/wallet/MoneroWallet.cpp +++ b/src/wallet/MoneroWallet.cpp @@ -105,7 +105,7 @@ namespace monero { tx->fee = pd.m_fee; tx->note = wallet2.get_tx_note(pd.m_tx_hash); if (tx->note->empty()) tx->note = boost::none; // clear empty note - tx->isCoinbase = pd.m_coinbase ? true : false; + tx->isMinerTx = pd.m_coinbase ? true : false; tx->isConfirmed = true; tx->isFailed = false; tx->isRelayed = true; @@ -156,7 +156,7 @@ namespace monero { tx->fee = pd.m_amount_in - pd.m_amount_out; tx->note = wallet2.get_tx_note(txid); if (tx->note->empty()) tx->note = boost::none; // clear empty note - tx->isCoinbase = false; + tx->isMinerTx = false; tx->isConfirmed = true; tx->isFailed = false; tx->isRelayed = true; @@ -222,7 +222,7 @@ namespace monero { tx->fee = pd.m_fee; tx->note = wallet2.get_tx_note(pd.m_tx_hash); if (tx->note->empty()) tx->note = boost::none; // clear empty note - tx->isCoinbase = false; + tx->isMinerTx = false; tx->isConfirmed = false; tx->isFailed = false; tx->isRelayed = true; @@ -262,7 +262,7 @@ namespace monero { tx->fee = pd.m_amount_in - pd.m_amount_out; tx->note = wallet2.get_tx_note(txid); if (tx->note->empty()) tx->note = boost::none; // clear empty note - tx->isCoinbase = false; + tx->isMinerTx = false; tx->isConfirmed = false; tx->isRelayed = !tx->isFailed.get(); tx->inTxPool = !tx->isFailed.get(); @@ -1786,7 +1786,7 @@ namespace monero { // init other known fields tx->paymentId = request.paymentId; tx->isConfirmed = false; - tx->isCoinbase = false; + tx->isMinerTx = false; tx->isFailed = false; // TODO: test and handle if true tx->doNotRelay = request.doNotRelay != boost::none && request.doNotRelay.get() == true; tx->isRelayed = tx->doNotRelay.get() != true; @@ -1895,7 +1895,7 @@ namespace monero { // init other known fields tx->paymentId = request.paymentId; tx->isConfirmed = false; - tx->isCoinbase = false; + tx->isMinerTx = false; tx->isFailed = false; // TODO: test and handle if true tx->doNotRelay = request.doNotRelay != boost::none && request.doNotRelay.get() == true; tx->isRelayed = tx->doNotRelay.get() != true; @@ -1973,7 +1973,7 @@ namespace monero { // init other known fields tx->isConfirmed = false; - tx->isCoinbase = false; + tx->isMinerTx = false; tx->isFailed = false; // TODO: test and handle if true tx->doNotRelay = doNotRelay; tx->isRelayed = tx->doNotRelay.get() != true; diff --git a/src/wallet/MoneroWalletModel.cpp b/src/wallet/MoneroWalletModel.cpp index ff792ed..1af52f4 100644 --- a/src/wallet/MoneroWalletModel.cpp +++ b/src/wallet/MoneroWalletModel.cpp @@ -239,7 +239,7 @@ namespace monero { if (inTxPool != boost::none && inTxPool != tx->inTxPool) return false; if (doNotRelay != boost::none && doNotRelay != tx->doNotRelay) return false; if (isFailed != boost::none && isFailed != tx->isFailed) return false; - if (isCoinbase != boost::none && isCoinbase != tx->isCoinbase) return false; + if (isMinerTx != boost::none && isMinerTx != tx->isMinerTx) return false; // at least one transfer must meet transfer request if defined if (transferRequest != boost::none) {