net: Manage SMSG pubkeys in BSX.

This commit is contained in:
tecnovert
2025-07-16 22:53:03 +02:00
parent e73e084a6d
commit 10d6b13930
3 changed files with 99 additions and 86 deletions

View File

@@ -7545,7 +7545,7 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
self.log.debug("Ignoring expired offer.")
return
_ = self.expandMessageNets(offer_data.message_nets)
_ = self.expandMessageNets(offer_data.message_nets) # Decode to validate
offer_rate: int = ci_from.make_int(
offer_data.amount_to / offer_data.amount_from, r=1
@@ -7988,6 +7988,8 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
bid_rate: int = ci_from.make_int(bid_data.amount_to / bid_data.amount, r=1)
self.validateBidAmount(offer, bid_data.amount, bid_rate)
_ = self.expandMessageNets(bid_data.message_nets) # Decode to validate
network_type: str = msg.get("msg_net", "smsg")
network_type_received_on_id: int = networkTypeToID(network_type)
bid_message_nets: str = self.selectMessageNetString([network_type_received_on_id, ], bid_data.message_nets)
@@ -8449,6 +8451,8 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
if ci_to.curve_type() == Curves.ed25519:
ensure(len(bid_data.kbsf_dleag) <= 16000, "Invalid kbsf_dleag size")
_ = self.expandMessageNets(bid_data.message_nets) # Decode to validate
bid_id = bytes.fromhex(msg["msgid"])
network_type: str = msg.get("msg_net", "smsg")
@@ -9977,7 +9981,7 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
ensure(offer.swap_type == SwapTypes.XMR_SWAP, "Bid/offer swap type mismatch")
ensure(xmr_offer, f"Adaptor-sig offer not found: {self.log.id(offer_id)}.")
_ = self.expandMessageNets(bid_data.message_nets)
_ = self.expandMessageNets(bid_data.message_nets) # Decode to validate
ci_from = self.ci(offer.coin_to)
ci_to = self.ci(offer.coin_from)