Skip to content

Commit 2a48cb6

Browse files
committed
added skip for dust for transactions sent to burn address
1 parent b9de46a commit 2a48cb6

File tree

5 files changed

+20
-345
lines changed

5 files changed

+20
-345
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ venv/
55
venv27/
66

77
compile_commands.json
8+
pastel-config.h.in
89

910
*.tar.gz
1011
*.deb

src/accept_to_mempool.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ bool IsStandardTx(const CTransaction& tx, string& reason, const CChainParams& ch
7979
}
8080
}
8181

82+
const auto& destBurnAddress = chainparams.getPastelBurnAddressHash();
8283
for (const auto& txin : tx.vin)
8384
{
8485
// Biggest 'standard' txin is a 15-of-15 P2SH multisig with compressed
@@ -115,7 +116,16 @@ bool IsStandardTx(const CTransaction& tx, string& reason, const CChainParams& ch
115116
else if ((whichType == TX_MULTISIG) && (!fIsBareMultisigStd)) {
116117
reason = "bare-multisig";
117118
return false;
118-
} else if (txout.IsDust(gl_ChainOptions.minRelayTxFee)) {
119+
}
120+
121+
// skip dust check if transaction is to the burn transaction
122+
bool bSkipDustCheck = false;
123+
if ((whichType == TX_PUBKEYHASH) || (whichType == TX_SCRIPTHASH))
124+
{
125+
const uint160 addressHash = txout.scriptPubKey.AddressHash();
126+
bSkipDustCheck = (addressHash == destBurnAddress);
127+
}
128+
if (!bSkipDustCheck && txout.IsDust(gl_ChainOptions.minRelayTxFee)) {
119129
reason = "dust";
120130
return false;
121131
}

src/config/pastel-config.h.in

Lines changed: 0 additions & 342 deletions
This file was deleted.

src/primitives/transaction.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,12 +454,14 @@ class CTxOut
454454
return 0;
455455

456456
const size_t nSize = GetSerializeSize(*this, SER_DISK, 0) + 148u;
457+
457458
return 3*minRelayTxFee.GetFee(nSize);
458459
}
459460

460461
bool IsDust(const CFeeRate &minRelayTxFee) const
461462
{
462-
return (nValue < GetDustThreshold(minRelayTxFee));
463+
auto dustThreshold = GetDustThreshold(minRelayTxFee);
464+
return (nValue < dustThreshold);
463465
}
464466

465467
friend bool operator==(const CTxOut& a, const CTxOut& b)

0 commit comments

Comments
 (0)