Skip to content

Commit 50fd642

Browse files
committed
[BDAP] Consider bdap burned amount as fees in accept to mempool
1 parent 9f8596e commit 50fd642

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/validation.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "alert.h"
1111
#include "arith_uint256.h"
1212
#include "bdap/domainentrydb.h"
13+
#include "bdap/fees.h"
1314
#include "bdap/linking.h"
1415
#include "bdap/linkingdb.h"
1516
#include "bdap/utils.h"
@@ -1034,6 +1035,16 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C
10341035

10351036
CAmount nValueOut = tx.GetValueOut();
10361037
CAmount nFees = nValueIn - nValueOut;
1038+
CAmount nBDAPBurn = 0;
1039+
if (tx.nVersion == BDAP_TX_VERSION) {
1040+
// Since fees are burned, count BDAP burn funds into fee calculation
1041+
CAmount nOpCodeAmount;
1042+
ExtractAmountsFromTx(MakeTransactionRef(tx), nBDAPBurn, nOpCodeAmount);
1043+
if (nBDAPBurn > 0)
1044+
nFees += nBDAPBurn;
1045+
1046+
LogPrintf("%s -- BDAP Burn Amount %d, Total Fees %d, BDAP Deposit Amount %d\n", __func__, FormatMoney(nBDAPBurn), FormatMoney(nFees), FormatMoney(nOpCodeAmount));
1047+
}
10371048
// nModifiedFees includes any fee deltas from PrioritiseTransaction
10381049
CAmount nModifiedFees = nFees;
10391050
double nPriorityDummy = 0;
@@ -1096,7 +1107,7 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C
10961107
dFreeCount += nSize;
10971108
}
10981109

1099-
if (nAbsurdFee && nFees > nAbsurdFee)
1110+
if (nAbsurdFee && nFees - nBDAPBurn > nAbsurdFee)
11001111
return state.Invalid(false,
11011112
REJECT_HIGHFEE, "absurdly-high-fee",
11021113
strprintf("%d > %d", nFees, nAbsurdFee));

0 commit comments

Comments
 (0)