Skip to content

Commit 75de576

Browse files
committed
feat: remove pre-withdrawals fork logic for quorum expiration
1 parent fb87a5a commit 75de576

File tree

2 files changed

+6
-19
lines changed

2 files changed

+6
-19
lines changed

src/evo/assetlocktx.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,8 @@ bool CAssetUnlockPayload::VerifySig(const llmq::CQuorumManager& qman, const uint
122122
const auto& llmq_params_opt = Params().GetLLMQ(llmqType);
123123
assert(llmq_params_opt.has_value());
124124

125-
// We check two quorums before DEPLOYMENT_WITHDRAWALS activation
126-
// and "all active quorums + 1 the latest inactive" after activation.
127-
const int quorums_to_scan = DeploymentActiveAt(*pindexTip, Params().GetConsensus(), Consensus::DEPLOYMENT_WITHDRAWALS)
128-
? (llmq_params_opt->signingActiveQuorumCount + 1)
129-
: 2;
125+
// We check all active quorums + 1 the latest inactive
126+
const int quorums_to_scan = llmq_params_opt->signingActiveQuorumCount + 1;
130127
const auto quorums = qman.ScanQuorums(llmqType, pindexTip, quorums_to_scan);
131128

132129
if (bool isActive = std::any_of(quorums.begin(), quorums.end(), [&](const auto &q) { return q->qc->quorumHash == quorumHash; }); !isActive) {

test/functional/feature_asset_locks.py

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -361,11 +361,12 @@ def test_asset_unlocks(self, node_wallet, node, pubkey):
361361
result_expected={'allowed': False, 'reject-reason' : 'max-fee-exceeded'})
362362
self.check_mempool_result(tx=asset_unlock_tx_zero_fee,
363363
result_expected={'allowed': False, 'reject-reason' : 'bad-txns-assetunlock-fee-outofrange'})
364-
# not-verified is a correct faiure from mempool. Mempool knows nothing about CreditPool indexes and he just report that signature is not validated
364+
# not-verified is a correct error message when adding to mempool because Mempool knows nothing about CreditPool and indexes.
365+
# but the signature is invalid so far as we changed index without re-signing it by quorum
365366
self.check_mempool_result(tx=asset_unlock_tx_duplicate_index,
366367
result_expected={'allowed': False, 'reject-reason' : 'bad-assetunlock-not-verified'})
367368

368-
self.log.info("Validating that we calculate payload hash correctly: ask quorum forcely by message hash...")
369+
self.log.info("Validating payload hash calculation by using hard-coded message hash")
369370
asset_unlock_tx_payload = CAssetUnlockTx()
370371
asset_unlock_tx_payload.deserialize(BytesIO(asset_unlock_tx.vExtraPayload))
371372

@@ -441,28 +442,17 @@ def test_asset_unlocks(self, node_wallet, node, pubkey):
441442
self.check_mempool_result(tx=asset_unlock_tx_too_late,
442443
result_expected={'allowed': False, 'reject-reason' : 'bad-assetunlock-too-late'})
443444

444-
self.log.info("Checking that two quorums later it is too late because quorum is not active...")
445-
self.mine_quorum_2_nodes()
446-
self.log.info("Expecting new reject-reason...")
447-
assert not softfork_active(self.nodes[0], 'withdrawals')
448-
self.check_mempool_result(tx=asset_unlock_tx_too_late,
449-
result_expected={'allowed': False, 'reject-reason' : 'bad-assetunlock-too-old-quorum'})
450-
451445
block_to_reconsider = node.getbestblockhash()
452446
self.log.info("Test block invalidation with asset unlock tx...")
453447
for inode in self.nodes:
454448
inode.invalidateblock(block_asset_unlock)
455449
self.validate_credit_pool_balance(locked)
456-
self.generate_batch(50)
450+
self.generate_batch(25)
457451
self.validate_credit_pool_balance(locked)
458452
for inode in self.nodes:
459453
inode.reconsiderblock(block_to_reconsider)
460454
self.validate_credit_pool_balance(locked - 2 * COIN)
461455

462-
self.log.info("Forcibly mining asset_unlock_tx_too_late and ensure block is invalid")
463-
assert not softfork_active(self.nodes[0], 'withdrawals')
464-
self.create_and_check_block([asset_unlock_tx_too_late], expected_error = "bad-assetunlock-too-old-quorum")
465-
466456
self.generate(node, 1)
467457

468458
self.validate_credit_pool_balance(locked - 2 * COIN)

0 commit comments

Comments
 (0)