mirror of
https://github.com/wownero/wownero-cpp.git
synced 2026-10-18 15:51:34 +02:00
add merge vins impl to MoneroTx()::merge();
define output / key image merge()
This commit is contained in:
@@ -194,6 +194,33 @@ namespace monero {
|
||||
unlockTime = MoneroUtils::reconcile(unlockTime, tx.unlockTime);
|
||||
numConfirmations = MoneroUtils::reconcile(numConfirmations, tx.numConfirmations);
|
||||
|
||||
// merge vins
|
||||
if (!tx.vins.empty()) {
|
||||
for (const shared_ptr<MoneroOutput>& merger : tx.vins) {
|
||||
bool merged = false;
|
||||
merger->tx = shared_ptr<MoneroTx>(this); // TODO: can this cause this* to be deleted prematurely?
|
||||
for (const shared_ptr<MoneroOutput>& mergee : vins) {
|
||||
//if (mergee.getKeyImage().getHex().equals(merger.getKeyImage().getHex())) {
|
||||
if ((*mergee->keyImage)->hex == (*merger->keyImage)->hex) {
|
||||
mergee->merge(*merger);
|
||||
merged = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!merged) vins.push_back(merger);
|
||||
}
|
||||
}
|
||||
|
||||
throw runtime_error("Not implemented");
|
||||
}
|
||||
|
||||
void MoneroKeyImage::merge(const MoneroKeyImage& keyImage) {
|
||||
cout << "MoneroKeyImage::merge()" << endl;
|
||||
throw runtime_error("Not implemented");
|
||||
}
|
||||
|
||||
void MoneroOutput::merge(const MoneroOutput& output) {
|
||||
cout << "MoneroOutput::merge()" << endl;
|
||||
throw runtime_error("Not implemented");
|
||||
}
|
||||
|
||||
|
||||
@@ -156,6 +156,8 @@ namespace monero {
|
||||
struct MoneroKeyImage {
|
||||
boost::optional<string> hex;
|
||||
boost::optional<string> signature;
|
||||
|
||||
void merge(const MoneroKeyImage& keyImage);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -163,11 +165,13 @@ namespace monero {
|
||||
*/
|
||||
struct MoneroOutput {
|
||||
shared_ptr<MoneroTx> tx;
|
||||
boost::optional<MoneroKeyImage> keyImage;
|
||||
boost::optional<shared_ptr<MoneroKeyImage>> keyImage;
|
||||
boost::optional<uint64_t> amount;
|
||||
boost::optional<uint32_t> index;
|
||||
vector<uint32_t> ringOutputIndices;
|
||||
boost::optional<string> stealthPublicKey;
|
||||
|
||||
void merge(const MoneroOutput& output);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user