mirror of
https://github.com/wownero/wownero-cpp.git
synced 2026-10-17 15:21:30 +02:00
rename coinbaseTx -> minerTx
This commit is contained in:
@@ -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<MoneroTx> 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<MoneroTx>& src, const shared_ptr<MoneroTx>& 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);
|
||||
|
||||
@@ -125,7 +125,7 @@ namespace monero {
|
||||
boost::optional<uint32_t> majorVersion;
|
||||
boost::optional<uint32_t> minorVersion;
|
||||
boost::optional<uint64_t> nonce;
|
||||
boost::optional<string> coinbaseTxId;
|
||||
boost::optional<string> minerTxId;
|
||||
boost::optional<uint32_t> numTxs;
|
||||
boost::optional<bool> orphanStatus;
|
||||
boost::optional<string> prevId;
|
||||
@@ -141,7 +141,7 @@ namespace monero {
|
||||
*/
|
||||
struct MoneroBlock : public MoneroBlockHeader {
|
||||
boost::optional<string> hex;
|
||||
boost::optional<shared_ptr<MoneroTx>> coinbaseTx;
|
||||
boost::optional<shared_ptr<MoneroTx>> minerTx;
|
||||
vector<shared_ptr<MoneroTx>> txs;
|
||||
vector<string> txIds;
|
||||
|
||||
@@ -158,7 +158,7 @@ namespace monero {
|
||||
boost::optional<shared_ptr<MoneroBlock>> block;
|
||||
boost::optional<string> id;
|
||||
boost::optional<uint32_t> version;
|
||||
boost::optional<bool> isCoinbase;
|
||||
boost::optional<bool> isMinerTx;
|
||||
boost::optional<string> paymentId;
|
||||
boost::optional<uint64_t> fee;
|
||||
boost::optional<uint32_t> mixin;
|
||||
|
||||
@@ -153,7 +153,7 @@ void nodeToTx(const boost::property_tree::ptree& node, shared_ptr<MoneroTx> 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<bool>();
|
||||
else if (key == string("isMinerTx")) tx->isMinerTx = it->second.get_value<bool>();
|
||||
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<MoneroBlock> 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<MoneroTx> 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<MoneroOutput> vin = initAsTxWallet ? make_shared<MoneroOutputWallet>() : make_shared<MoneroOutput>();
|
||||
vin->tx = tx;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user