Skip to content

Commit bb6d386

Browse files
committed
fix: make composite rpc 'masternode payments' to work with withdrawals
1 parent e498378 commit bb6d386

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/rpc/masternode.cpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

55
#include <chainparams.h>
6+
#include <evo/assetlocktx.h>
67
#include <evo/chainhelper.h>
78
#include <evo/deterministicmns.h>
89
#include <governance/classes.h>
@@ -406,13 +407,19 @@ static RPCHelpMan masternode_payments()
406407
if (tx->IsCoinBase()) {
407408
continue;
408409
}
409-
CAmount nValueIn{0};
410-
for (const auto& txin : tx->vin) {
411-
uint256 blockHashTmp;
412-
CTransactionRef txPrev = GetTransaction(/* block_index */ nullptr, &mempool, txin.prevout.hash, Params().GetConsensus(), blockHashTmp);
413-
nValueIn += txPrev->vout[txin.prevout.n].nValue;
410+
if (!tx->IsPlatformTransfer()) {
411+
CAmount nValueIn{0};
412+
for (const auto& txin : tx->vin) {
413+
uint256 blockHashTmp;
414+
CTransactionRef txPrev = GetTransaction(/* block_index */ nullptr, &mempool, txin.prevout.hash, Params().GetConsensus(), blockHashTmp);
415+
nValueIn += txPrev->vout[txin.prevout.n].nValue;
416+
}
417+
nBlockFees += nValueIn - tx->GetValueOut();
418+
} else {
419+
if (const auto opt_assetUnlockTx = GetTxPayload<CAssetUnlockPayload>(*tx)) {
420+
nBlockFees += opt_assetUnlockTx->getFee();
421+
}
414422
}
415-
nBlockFees += nValueIn - tx->GetValueOut();
416423
}
417424

418425
std::vector<CTxOut> voutMasternodePayments, voutDummy;

0 commit comments

Comments
 (0)