mirror of
https://github.com/basicswap/basicswap.git
synced 2025-11-06 02:38:11 +01:00
Check for duplicate pubkeys.
Add test for 'non-BIP68-final'.
This commit is contained in:
0
basicswap/protocols/__init__.py
Normal file
0
basicswap/protocols/__init__.py
Normal file
43
basicswap/protocols/atomic_swap_1.py
Normal file
43
basicswap/protocols/atomic_swap_1.py
Normal file
@@ -0,0 +1,43 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (c) 2020 tecnovert
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
from basicswap.util import (
|
||||
SerialiseNum,
|
||||
)
|
||||
from basicswap.script import (
|
||||
OpCodes,
|
||||
)
|
||||
|
||||
|
||||
def buildContractScript(lock_val, secret_hash, pkh_redeem, pkh_refund, op_lock=OpCodes.OP_CHECKSEQUENCEVERIFY):
|
||||
script = bytearray([
|
||||
OpCodes.OP_IF,
|
||||
OpCodes.OP_SIZE,
|
||||
0x01, 0x20, # 32
|
||||
OpCodes.OP_EQUALVERIFY,
|
||||
OpCodes.OP_SHA256,
|
||||
0x20]) \
|
||||
+ secret_hash \
|
||||
+ bytearray([
|
||||
OpCodes.OP_EQUALVERIFY,
|
||||
OpCodes.OP_DUP,
|
||||
OpCodes.OP_HASH160,
|
||||
0x14]) \
|
||||
+ pkh_redeem \
|
||||
+ bytearray([OpCodes.OP_ELSE, ]) \
|
||||
+ SerialiseNum(lock_val) \
|
||||
+ bytearray([
|
||||
op_lock,
|
||||
OpCodes.OP_DROP,
|
||||
OpCodes.OP_DUP,
|
||||
OpCodes.OP_HASH160,
|
||||
0x14]) \
|
||||
+ pkh_refund \
|
||||
+ bytearray([
|
||||
OpCodes.OP_ENDIF,
|
||||
OpCodes.OP_EQUALVERIFY,
|
||||
OpCodes.OP_CHECKSIG])
|
||||
return script
|
||||
5
basicswap/protocols/xmr_swap_1.py
Normal file
5
basicswap/protocols/xmr_swap_1.py
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (c) 2020 tecnovert
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
|
||||
Reference in New Issue
Block a user