Skip to content

Commit

Permalink
test package rbf boundary conditions more closely
Browse files Browse the repository at this point in the history
  • Loading branch information
instagibbs committed Jun 17, 2024
1 parent 36f0441 commit 856c174
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions test/functional/mempool_package_rbf.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,22 +169,34 @@ def test_package_rbf_additional_fees(self):

self.log.info("Check replacement pays for incremental bandwidth")
package_hex3, package_txns3 = self.create_simple_package(coin, parent_fee=DEFAULT_FEE, child_fee=DEFAULT_CHILD_FEE)
package_3_size = sum([tx.get_vsize() for tx in package_txns3])
incremental_sats_required = Decimal(package_3_size) / COIN
incremental_sats_short = incremental_sats_required - Decimal("0.00000001")
# Recreate the package with slightly higher fee once we know the size of the new package, but still short of required fee
package_hex3, package_txns3 = self.create_simple_package(coin, parent_fee=DEFAULT_FEE, child_fee=DEFAULT_CHILD_FEE + incremental_sats_short)
assert_equal(package_3_size, sum([tx.get_vsize() for tx in package_txns3]))
pkg_results3 = node.submitpackage(package_hex3)
assert_equal(f"package RBF failed: insufficient anti-DoS fees, rejecting replacement {package_txns3[1].rehash()}, not enough additional fees to relay; 0.00 < 0.00000{sum([tx.get_vsize() for tx in package_txns3])}", pkg_results3["package_msg"])

assert_equal(f"package RBF failed: insufficient anti-DoS fees, rejecting replacement {package_txns3[1].rehash()}, not enough additional fees to relay; {incremental_sats_short} < {incremental_sats_required}", pkg_results3["package_msg"])
self.assert_mempool_contents(expected=package_txns1)

package_hex3_1, package_txns3_1 = self.create_simple_package(coin, parent_fee=DEFAULT_FEE, child_fee=DEFAULT_CHILD_FEE + incremental_sats_required)
node.submitpackage(package_hex3_1)
self.assert_mempool_contents(expected=package_txns3_1)
self.generate(node, 1)

self.log.info("Check Package RBF must have strict cpfp structure")
coin = self.coins.pop()
package_hex4, package_txns4 = self.create_simple_package(coin, parent_fee=DEFAULT_FEE, child_fee=DEFAULT_CHILD_FEE)
node.submitpackage(package_hex4)
self.assert_mempool_contents(expected=package_txns4)
package_hex5, package_txns5 = self.create_simple_package(coin, parent_fee=DEFAULT_CHILD_FEE, child_fee=DEFAULT_CHILD_FEE - Decimal("0.00000001"))
package_hex5, package_txns5 = self.create_simple_package(coin, parent_fee=DEFAULT_CHILD_FEE, child_fee=DEFAULT_CHILD_FEE)
pkg_results5 = node.submitpackage(package_hex5)
assert 'package RBF failed: package feerate is less than parent feerate' in pkg_results5["package_msg"]

self.assert_mempool_contents(expected=package_txns4)

package_hex5_1, package_txns5_1 = self.create_simple_package(coin, parent_fee=DEFAULT_CHILD_FEE, child_fee=DEFAULT_CHILD_FEE + Decimal("0.00000001"))
pkg_results5_1 = node.submitpackage(package_hex5_1)
self.assert_mempool_contents(expected=package_txns5_1)
self.generate(node, 1)

def test_package_rbf_max_conflicts(self):
Expand Down

0 comments on commit 856c174

Please sign in to comment.