From b0a01dc681d4485dc0928e66f50d514155deef1f Mon Sep 17 00:00:00 2001 From: Peter Bushnell Date: Sat, 5 Dec 2020 06:09:52 +0000 Subject: [PATCH 1/3] Reduce amount selected --- src/omnicore/encoding.cpp | 6 +++++- src/omnicore/encoding.h | 4 +++- src/omnicore/wallettxbuilder.cpp | 10 +++++++--- src/omnicore/walletutils.cpp | 4 ++-- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/omnicore/encoding.cpp b/src/omnicore/encoding.cpp index fb45b780f0eb5..3764dc1802ae8 100644 --- a/src/omnicore/encoding.cpp +++ b/src/omnicore/encoding.cpp @@ -23,7 +23,7 @@ * https://github.com/mastercoin-MSC/spec#class-b-transactions-also-known-as-the-multisig-method */ bool OmniCore_Encode_ClassB(const std::string& senderAddress, const CPubKey& redeemingPubKey, - const std::vector& vchPayload, std::vector >& vecOutputs) + const std::vector& vchPayload, std::vector >& vecOutputs, CAmount *outputAmount) { unsigned int nRemainingBytes = vchPayload.size(); unsigned int nNextByte = 0; @@ -65,11 +65,15 @@ bool OmniCore_Encode_ClassB(const std::string& senderAddress, const CPubKey& red // Push back a bare multisig output with obfuscated data CScript scriptMultisigOut = GetScriptForMultisig(1, vKeys); + if (outputAmount) + *outputAmount += OmniGetDustThreshold(scriptMultisigOut); vecOutputs.push_back(std::make_pair(scriptMultisigOut, OmniGetDustThreshold(scriptMultisigOut))); } // Add the Exodus marker output CScript scriptExodusOutput = GetScriptForDestination(ExodusAddress()); + if (outputAmount) + *outputAmount += OmniGetDustThreshold(scriptExodusOutput); vecOutputs.push_back(std::make_pair(scriptExodusOutput, OmniGetDustThreshold(scriptExodusOutput))); return true; } diff --git a/src/omnicore/encoding.h b/src/omnicore/encoding.h index a894a66e84756..a87d6dd11b0f4 100644 --- a/src/omnicore/encoding.h +++ b/src/omnicore/encoding.h @@ -4,6 +4,7 @@ class CPubKey; class CTxOut; +#include #include