mirror of
https://github.com/basicswap/basicswap.git
synced 2026-06-08 04:01:41 +02:00
fix: get actual blinded Part refund vout
This commit is contained in:
+12
-3
@@ -7964,11 +7964,14 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
|
|||||||
"",
|
"",
|
||||||
cursor,
|
cursor,
|
||||||
)
|
)
|
||||||
|
refund_vout: int = ci_from.getLockRefundVout(
|
||||||
|
xmr_swap.a_lock_refund_tx, xmr_swap.vkbv
|
||||||
|
)
|
||||||
bid.txns[TxTypes.XMR_SWAP_A_LOCK_REFUND] = SwapTx(
|
bid.txns[TxTypes.XMR_SWAP_A_LOCK_REFUND] = SwapTx(
|
||||||
bid_id=bid_id,
|
bid_id=bid_id,
|
||||||
tx_type=TxTypes.XMR_SWAP_A_LOCK_REFUND,
|
tx_type=TxTypes.XMR_SWAP_A_LOCK_REFUND,
|
||||||
txid=bytes.fromhex(txid),
|
txid=bytes.fromhex(txid),
|
||||||
vout=0,
|
vout=refund_vout,
|
||||||
)
|
)
|
||||||
self.saveBidInSession(bid_id, bid, cursor, xmr_swap)
|
self.saveBidInSession(bid_id, bid, cursor, xmr_swap)
|
||||||
self.commitDB()
|
self.commitDB()
|
||||||
@@ -7980,11 +7983,14 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
|
|||||||
)
|
)
|
||||||
txid = ci_from.getTxid(xmr_swap.a_lock_refund_tx)
|
txid = ci_from.getTxid(xmr_swap.a_lock_refund_tx)
|
||||||
if TxTypes.XMR_SWAP_A_LOCK_REFUND not in bid.txns:
|
if TxTypes.XMR_SWAP_A_LOCK_REFUND not in bid.txns:
|
||||||
|
refund_vout: int = ci_from.getLockRefundVout(
|
||||||
|
xmr_swap.a_lock_refund_tx, xmr_swap.vkbv
|
||||||
|
)
|
||||||
bid.txns[TxTypes.XMR_SWAP_A_LOCK_REFUND] = SwapTx(
|
bid.txns[TxTypes.XMR_SWAP_A_LOCK_REFUND] = SwapTx(
|
||||||
bid_id=bid_id,
|
bid_id=bid_id,
|
||||||
tx_type=TxTypes.XMR_SWAP_A_LOCK_REFUND,
|
tx_type=TxTypes.XMR_SWAP_A_LOCK_REFUND,
|
||||||
txid=txid,
|
txid=txid,
|
||||||
vout=0,
|
vout=refund_vout,
|
||||||
)
|
)
|
||||||
self.saveBidInSession(bid_id, bid, cursor, xmr_swap)
|
self.saveBidInSession(bid_id, bid, cursor, xmr_swap)
|
||||||
self.commitDB()
|
self.commitDB()
|
||||||
@@ -9058,11 +9064,14 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if TxTypes.XMR_SWAP_A_LOCK_REFUND not in bid.txns:
|
if TxTypes.XMR_SWAP_A_LOCK_REFUND not in bid.txns:
|
||||||
|
refund_vout: int = ci_from.getLockRefundVout(
|
||||||
|
bytes.fromhex(spend_txn_hex), xmr_swap.vkbv
|
||||||
|
)
|
||||||
bid.txns[TxTypes.XMR_SWAP_A_LOCK_REFUND] = SwapTx(
|
bid.txns[TxTypes.XMR_SWAP_A_LOCK_REFUND] = SwapTx(
|
||||||
bid_id=bid.bid_id,
|
bid_id=bid.bid_id,
|
||||||
tx_type=TxTypes.XMR_SWAP_A_LOCK_REFUND,
|
tx_type=TxTypes.XMR_SWAP_A_LOCK_REFUND,
|
||||||
txid=xmr_swap.a_lock_refund_tx_id,
|
txid=xmr_swap.a_lock_refund_tx_id,
|
||||||
vout=0,
|
vout=refund_vout,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
self.setBidError(
|
self.setBidError(
|
||||||
|
|||||||
@@ -192,6 +192,9 @@ class AdaptorSigInterface:
|
|||||||
def getScriptLockRefundSwipeTxDummyWitness(self, script: bytes) -> List[bytes]:
|
def getScriptLockRefundSwipeTxDummyWitness(self, script: bytes) -> List[bytes]:
|
||||||
return [bytes(72), b"", bytes(len(script))]
|
return [bytes(72), b"", bytes(len(script))]
|
||||||
|
|
||||||
|
def getLockRefundVout(self, lock_refund_tx_data: bytes, vbkv: bytes):
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
class Secp256k1Interface(CoinInterface, AdaptorSigInterface):
|
class Secp256k1Interface(CoinInterface, AdaptorSigInterface):
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
|
|||||||
@@ -1299,6 +1299,17 @@ class PARTInterfaceBlind(PARTInterface):
|
|||||||
"fundrawtransactionfrom", ["blind", tx_hex, {}, outputs_info, options]
|
"fundrawtransactionfrom", ["blind", tx_hex, {}, outputs_info, options]
|
||||||
)["hex"]
|
)["hex"]
|
||||||
|
|
||||||
|
def getLockRefundVout(self, lock_refund_tx_data: bytes, vkbv: bytes):
|
||||||
|
lock_refund_tx_obj = self.rpc(
|
||||||
|
"decoderawtransaction", [lock_refund_tx_data.hex()]
|
||||||
|
)
|
||||||
|
# Nonce is derived from vkbv
|
||||||
|
nonce = self.getScriptLockRefundTxNonce(vkbv)
|
||||||
|
|
||||||
|
# Find the output of the lock refund tx to spend
|
||||||
|
spend_n, input_blinded_info = self.findOutputByNonce(lock_refund_tx_obj, nonce)
|
||||||
|
return spend_n
|
||||||
|
|
||||||
|
|
||||||
class PARTInterfaceAnon(PARTInterface):
|
class PARTInterfaceAnon(PARTInterface):
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user