fix: unblinded re/issuance for non-policy asset greater than 21 million (#1445)

* test: add test for unblinded re/issuance greater than 21 million

Co-authored-by: Mihailo Milenkovic <mihailo.milenkovic84@gmail.com>

* fix: unblinded re/issuance for greater than 21 million

Co-authored-by: Mihailo Milenkovic <mihailo.milenkovic84@gmail.com>

* enable with param config

* change range check to policy with config option

* refactoring, additional error messages and test extension

---------

Co-authored-by: Mihailo Milenkovic <mihailo.milenkovic84@gmail.com>
Co-authored-by: Tom Trevethan <ttrevethan@blockstream.com>
This commit is contained in:
Byron Hambly 2025-09-23 13:17:02 +02:00 committed by GitHub
parent e145690b42
commit 93c84a97f9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 73 additions and 3 deletions

View file

@ -151,6 +151,7 @@ bool g_parallel_script_checks{false};
bool fRequireStandard = true;
bool fCheckBlockIndex = false;
bool fCheckpointsEnabled = DEFAULT_CHECKPOINTS_ENABLED;
bool fAcceptUnlimitedIssuances = true;
int64_t nMaxTipAge = DEFAULT_MAX_TIP_AGE;
uint256 hashAssumeValid;
@ -722,6 +723,10 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
}
}
// Check unblinded issuance is in MoneyRange if configured
if (!fAcceptUnlimitedIssuances && !IsIssuanceInMoneyRange(tx))
return state.Invalid(TxValidationResult::TX_NOT_STANDARD, "issuance-out-of-range", "Issuance is greater than 21 million and acceptunlimitedissuances is not enabled.");
// Do not work on transactions that are too small.
// A transaction with 1 segwit input and 1 P2WPHK output has non-witness size of 82 bytes.
// Transactions smaller than this are not relayed to mitigate CVE-2017-12842 by not relaying