Skip to content

Commit b874eb6

Browse files
authored
Merge pull request #78 from AnduroProject/AN-476-add-preconf-output-validation
including tx validation on consensus level and change size validation…
2 parents ec8eecc + bbb4662 commit b874eb6

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

src/policy/policy.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,12 @@ bool IsStandardTx(const CTransaction& tx, const std::optional<unsigned>& max_dat
172172
} else if ((whichType == TxoutType::MULTISIG) && (!permit_bare_multisig)) {
173173
reason = "bare-multisig";
174174
return false;
175+
176+
} else if (IsDust(txout, dust_relay_fee)) {
177+
if ((tx.nVersion != TRANSACTION_COORDINATE_ASSET_CREATE_VERSION && tx.nVersion != TRANSACTION_COORDINATE_ASSET_TRANSFER_VERSION && tx.nVersion != TRANSACTION_PRECONF_VERSION) || txout.nValue == 0) {
178+
reason = "dust";
179+
return false;
180+
}
175181
}
176182
}
177183

src/primitives/transaction.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ std::string CTransaction::ToString() const
144144
}
145145

146146
bool CTransaction::HasValidOutputCount() const {
147+
147148
if(this->version == TRANSACTION_PRECONF_VERSION || this->version == TRANSACTION_COORDINATE_ASSET_CREATE_VERSION) {
148149
return this->vout.size() > 1;
149150
}

src/validation.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3312,7 +3312,6 @@ bool Chainstate::ConnectSignedBlock(const SignedBlock& block) {
33123312
std::vector<PrecomputedTransactionData> txsdata(block.vtx.size());
33133313
for (unsigned int i = 0; i < block.vtx.size(); i++) {
33143314
CTransactionRef ptx = block.vtx[i];
3315-
33163315
const CTransaction& tx = *ptx;
33173316
if (i != 0) {
33183317
if (tx.version == TRANSACTION_PRECONF_VERSION && !tx.HasValidOutputCount()) {

0 commit comments

Comments
 (0)