Skip to content

Commit

Permalink
allow low fees for unlock txes, add test
Browse files Browse the repository at this point in the history
  • Loading branch information
UdjinM6 committed Jul 20, 2023
1 parent 2c6aa49 commit 0f35ff3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -981,6 +981,8 @@ static bool AcceptToMemoryPoolWithTime(const CChainParams& chainparams, CTxMemPo
const CAmount nAbsurdFee, bool test_accept) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
{
std::vector<COutPoint> coins_to_uncache;
// Let Asset Unlock tx into mempool ignoring all the limits
bypass_limits = bypass_limits || (tx->nVersion == 3 && tx->nType == TRANSACTION_ASSET_UNLOCK);
MemPoolAccept::ATMPArgs args { chainparams, state, nAcceptTime, bypass_limits, nAbsurdFee, coins_to_uncache, test_accept };

assert(std::addressof(::ChainstateActive()) == std::addressof(active_chainstate));
Expand Down
2 changes: 2 additions & 0 deletions test/functional/feature_asset_locks.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,11 +300,13 @@ def run_test(self):
asset_unlock_tx_too_late = self.create_assetunlock(103, COIN, pubkey)
asset_unlock_tx_too_big_fee = self.create_assetunlock(104, COIN, pubkey, fee=int(Decimal("0.1") * COIN))
asset_unlock_tx_zero_fee = self.create_assetunlock(105, COIN, pubkey, fee=0)
asset_unlock_tx_low_fee = self.create_assetunlock(106, COIN, pubkey, fee=1)
asset_unlock_tx_duplicate_index = copy.deepcopy(asset_unlock_tx)
asset_unlock_tx_duplicate_index.vout[0].nValue += COIN
too_late_height = node.getblock(node.getbestblockhash())["height"] + 48

self.check_mempool_result(tx=asset_unlock_tx, result_expected={'allowed': True})
self.check_mempool_result(tx=asset_unlock_tx_low_fee, result_expected={'allowed': True})
self.check_mempool_result(tx=asset_unlock_tx_too_big_fee,
result_expected={'allowed': False, 'reject-reason' : 'absurdly-high-fee'})
self.check_mempool_result(tx=asset_unlock_tx_zero_fee,
Expand Down

0 comments on commit 0f35ff3

Please sign in to comment.