From 35e485c91bd5780c5b39ca6dd65627b0eb2453b8 Mon Sep 17 00:00:00 2001 From: woodser Date: Sat, 22 Jun 2019 13:59:04 -0400 Subject: [PATCH] MoneroOutput::merge() impl --- src/daemon/MoneroDaemonModel.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/daemon/MoneroDaemonModel.cpp b/src/daemon/MoneroDaemonModel.cpp index 97d6ef6..60e7c29 100644 --- a/src/daemon/MoneroDaemonModel.cpp +++ b/src/daemon/MoneroDaemonModel.cpp @@ -307,6 +307,11 @@ namespace monero { void MoneroOutput::merge(const shared_ptr& self, const shared_ptr& other) { cout << "MoneroOutput::merge()" << endl; - throw runtime_error("Not implemented"); + if (this != self.get()) throw runtime_error("this != self"); + if (self == other) return; + if (keyImage == boost::none) keyImage = other->keyImage; + else if (other->keyImage != boost::none) keyImage.get()->merge(keyImage.get(), other->keyImage.get()); + amount = MoneroUtils::reconcile(amount, other->amount); + index = MoneroUtils::reconcile(index, other->index); } }