test: add test for underfunded itx

This commit is contained in:
tecnovert
2026-06-09 16:42:49 +02:00
parent 304e88646f
commit 379eaaf0db
4 changed files with 52 additions and 31 deletions
+11 -5
View File
@@ -6906,7 +6906,16 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
self.log.debug(
f"Create initiate txn for coin {ci.coin_name()} to {addr_to} for bid {self.log.id(bid_id)}"
)
txn_signed = ci.createRawSignedTransaction(addr_to, bid.amount)
amount_from: int = bid.amount
if bid.debug_ind == DebugTypes.MAKE_INVALID_ITX:
amount_from -= 100
self.logBidEvent(
bid.bid_id,
EventLogTypes.DEBUG_TWEAK_APPLIED,
f"Make invalid ITx for testing: {bid.debug_ind}",
None,
)
txn_signed = ci.createRawSignedTransaction(addr_to, amount_from)
txjs = ci.describeTx(txn_signed)
vout = getVoutByAddress(txjs, addr_to)
@@ -6997,13 +7006,10 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
if bid.debug_ind == DebugTypes.MAKE_INVALID_PTX:
amount_to -= 1
self.log.debug(
f"bid {self.log.id(bid_id)}: Make invalid PTx for testing: {bid.debug_ind}."
)
self.logBidEvent(
bid.bid_id,
EventLogTypes.DEBUG_TWEAK_APPLIED,
"ind {}".format(bid.debug_ind),
f"Make invalid PTx for testing: {bid.debug_ind}",
None,
)
+1
View File
@@ -232,6 +232,7 @@ class DebugTypes(IntEnum):
BID_DONT_SPEND_COIN_A_LOCK_REFUND2 = auto() # continues
CREATE_INVALID_COIN_B_LOCK = auto()
BUYER_STOP_AFTER_ITX = auto()
MAKE_INVALID_ITX = auto()
MAKE_INVALID_PTX = auto()
DONT_SPEND_ITX = auto()
SKIP_LOCK_TX_REFUND = auto()