mirror of
https://github.com/basicswap/basicswap.git
synced 2026-05-30 07:41:41 +02:00
refactor: remove duplicate method
This commit is contained in:
@@ -3965,7 +3965,7 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
|
||||
def isValidSwapDest(self, ci, dest: bytes):
|
||||
ensure(isinstance(dest, bytes), "Swap destination must be bytes")
|
||||
if ci.coin_type() in (Coins.PART_BLIND,):
|
||||
return ci.isValidPubkey(dest)
|
||||
return ci.verifyPubkey(dest)
|
||||
# TODO: allow p2wsh
|
||||
return ci.isValidAddressHash(dest)
|
||||
|
||||
@@ -10905,7 +10905,7 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
|
||||
)
|
||||
ensure(
|
||||
ci_from.isValidAddressHash(bid_data.dest_af)
|
||||
or ci_from.isValidPubkey(bid_data.dest_af),
|
||||
or ci_from.verifyPubkey(bid_data.dest_af),
|
||||
"Invalid destination address",
|
||||
)
|
||||
|
||||
|
||||
@@ -220,12 +220,6 @@ class Secp256k1Interface(CoinInterface, AdaptorSigInterface):
|
||||
if hash_len == 20:
|
||||
return True
|
||||
|
||||
def isValidPubkey(self, pubkey: bytes) -> bool:
|
||||
try:
|
||||
return self.verifyPubkey(pubkey)
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
def verifySig(self, pubkey: bytes, signed_hash: bytes, sig: bytes) -> bool:
|
||||
pubkey = PublicKey(pubkey)
|
||||
return pubkey.verify(sig, signed_hash, hasher=None)
|
||||
|
||||
Reference in New Issue
Block a user