From 8ec6d55963a60b7321d13a8738d20f2df4ad3b2a Mon Sep 17 00:00:00 2001 From: tecnovert Date: Mon, 14 Nov 2022 13:54:48 +0200 Subject: [PATCH] Fix decodeAddress without bech32 hrp --- basicswap/interface/dash.py | 4 ++++ basicswap/interface/firo.py | 4 +--- basicswap/interface/pivx.py | 4 ++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/basicswap/interface/dash.py b/basicswap/interface/dash.py index 783e386..0bed2ec 100644 --- a/basicswap/interface/dash.py +++ b/basicswap/interface/dash.py @@ -7,6 +7,7 @@ from .btc import BTCInterface from basicswap.chainparams import Coins +from basicswap.util.address import decodeAddress from mnemonic import Mnemonic @@ -22,6 +23,9 @@ class DASHInterface(BTCInterface): words = self.seedToMnemonic(key) self.rpc_callback('upgradetohd', [words, ]) + def decodeAddress(self, address): + return decodeAddress(address)[1:] + def checkExpectedSeed(self, key_hash): try: rv = self.rpc_callback('dumphdinfo') diff --git a/basicswap/interface/firo.py b/basicswap/interface/firo.py index 4ec421e..c5af17d 100644 --- a/basicswap/interface/firo.py +++ b/basicswap/interface/firo.py @@ -9,9 +9,7 @@ import hashlib from .btc import BTCInterface, find_vout_for_address_from_txobj from basicswap.chainparams import Coins -from basicswap.util.address import ( - decodeAddress, -) +from basicswap.util.address import decodeAddress from basicswap.contrib.test_framework.script import ( CScript, OP_0, diff --git a/basicswap/interface/pivx.py b/basicswap/interface/pivx.py index 8cc4c53..b41e6e5 100644 --- a/basicswap/interface/pivx.py +++ b/basicswap/interface/pivx.py @@ -7,6 +7,7 @@ from .btc import BTCInterface from basicswap.chainparams import Coins +from basicswap.util.address import decodeAddress from .contrib.pivx_test_framework.messages import ( CBlock, ToHex, @@ -32,6 +33,9 @@ class PIVXInterface(BTCInterface): txn_signed = self.rpc_callback('signrawtransaction', [txn_funded])['hex'] return txn_signed + def decodeAddress(self, address): + return decodeAddress(address)[1:] + def getBlockWithTxns(self, block_hash): # TODO: Bypass decoderawtransaction and getblockheader block = self.rpc_callback('getblock', [block_hash, False])