mirror of
https://github.com/basicswap/basicswap.git
synced 2025-11-06 02:38:11 +01:00
doge: Switch to custom binary.
This commit is contained in:
@@ -355,7 +355,13 @@ class BasicSwap(BaseApp):
|
||||
|
||||
# TODO: Set dynamically
|
||||
self.balance_only_coins = (Coins.LTC_MWEB,)
|
||||
self.scriptless_coins = (Coins.XMR, Coins.WOW, Coins.PART_ANON, Coins.FIRO, Coins.DOGE)
|
||||
self.scriptless_coins = (
|
||||
Coins.XMR,
|
||||
Coins.WOW,
|
||||
Coins.PART_ANON,
|
||||
Coins.FIRO,
|
||||
Coins.DOGE,
|
||||
)
|
||||
self.adaptor_swap_only_coins = self.scriptless_coins + (
|
||||
Coins.PART_BLIND,
|
||||
Coins.BCH,
|
||||
|
||||
@@ -86,7 +86,7 @@ DCR_VERSION_TAG = os.getenv("DCR_VERSION_TAG", "")
|
||||
BITCOINCASH_VERSION = os.getenv("BITCOINCASH_VERSION", "27.1.0")
|
||||
BITCOINCASH_VERSION_TAG = os.getenv("BITCOINCASH_VERSION_TAG", "")
|
||||
|
||||
DOGECOIN_VERSION = os.getenv("DOGECOIN_VERSION", "1.14.7")
|
||||
DOGECOIN_VERSION = os.getenv("DOGECOIN_VERSION", "23.2.1")
|
||||
DOGECOIN_VERSION_TAG = os.getenv("DOGECOIN_VERSION_TAG", "")
|
||||
|
||||
GUIX_SSL_CERT_DIR = None
|
||||
@@ -111,7 +111,7 @@ known_coins = {
|
||||
"firo": (FIRO_VERSION, FIRO_VERSION_TAG, ("reuben",)),
|
||||
"navcoin": (NAV_VERSION, NAV_VERSION_TAG, ("nav_builder",)),
|
||||
"bitcoincash": (BITCOINCASH_VERSION, BITCOINCASH_VERSION_TAG, ("Calin_Culianu",)),
|
||||
"dogecoin": (DOGECOIN_VERSION, DOGECOIN_VERSION_TAG, ("patricklodder",)),
|
||||
"dogecoin": (DOGECOIN_VERSION, DOGECOIN_VERSION_TAG, ("tecnovert",)),
|
||||
}
|
||||
|
||||
disabled_coins = [
|
||||
@@ -815,16 +815,14 @@ def prepareCore(coin, version_data, settings, data_dir, extra_opts={}):
|
||||
% (version, os_dir_name, signing_key_name, assert_filename)
|
||||
)
|
||||
elif coin == "dogecoin":
|
||||
release_url = "https://github.com/dogecoin/dogecoin/releases/download/v{}/{}".format(
|
||||
version + version_tag, release_filename
|
||||
)
|
||||
assert_filename = "{}-{}-{}-build.assert".format(
|
||||
coin, os_name, ".".join(version.split(".")[:2])
|
||||
)
|
||||
assert_url = (
|
||||
"https://raw.githubusercontent.com/dogecoin/gitian.sigs/master/%s-%s/%s/%s"
|
||||
% (version, os_dir_name, signing_key_name, assert_filename)
|
||||
release_url = (
|
||||
"https://github.com/tecnovert/dogecoin/releases/download/v{}/{}".format(
|
||||
version + version_tag, release_filename
|
||||
)
|
||||
)
|
||||
assert_filename = "{}-{}-{}-build.assert".format(coin, os_name, version)
|
||||
assert_url = f"https://raw.githubusercontent.com/tecnovert/guix.sigs/dogecoin/{version}/{signing_key_name}/noncodesigned.SHA256SUMS"
|
||||
|
||||
elif coin == "bitcoin":
|
||||
release_url = "https://bitcoincore.org/bin/bitcoin-core-{}/{}".format(
|
||||
version, release_filename
|
||||
@@ -1250,7 +1248,7 @@ def prepareDataDir(coin, settings, chain, particl_mnemonic, extra_opts={}):
|
||||
fp.write(chainname + "=1\n")
|
||||
else:
|
||||
fp.write(chain + "=1\n")
|
||||
if coin not in ("firo", "navcoin", "dogecoin"):
|
||||
if coin not in ("firo", "navcoin"):
|
||||
if chain == "testnet":
|
||||
fp.write("[test]\n\n")
|
||||
elif chain == "regtest":
|
||||
@@ -1730,6 +1728,7 @@ def initialise_wallets(
|
||||
Coins.PART,
|
||||
Coins.BTC,
|
||||
Coins.LTC,
|
||||
Coins.DOGE,
|
||||
Coins.DCR,
|
||||
Coins.DASH,
|
||||
)
|
||||
@@ -2301,8 +2300,8 @@ def main():
|
||||
"use_csv": False,
|
||||
"blocks_confirmed": 2,
|
||||
"conf_target": 2,
|
||||
"core_version_group": 14,
|
||||
"min_relay_fee": 0.00001,
|
||||
"core_version_group": 23,
|
||||
"min_relay_fee": 0.01, # RECOMMENDED_MIN_TX_FEE
|
||||
},
|
||||
"decred": {
|
||||
"connection_type": "rpc",
|
||||
|
||||
@@ -175,20 +175,20 @@ chainparams = {
|
||||
"rpcport": 44555,
|
||||
"pubkey_address": 113,
|
||||
"script_address": 196,
|
||||
"key_prefix": 239,
|
||||
"key_prefix": 241,
|
||||
"hrp": "tdge",
|
||||
"bip44": 3,
|
||||
"bip44": 1,
|
||||
"min_amount": 100000,
|
||||
"max_amount": 10000000 * COIN,
|
||||
"name": "testnet4",
|
||||
},
|
||||
"regtest": {
|
||||
"rpcport": 18332,
|
||||
"pubkey_address": 113,
|
||||
"pubkey_address": 111,
|
||||
"script_address": 196,
|
||||
"key_prefix": 239,
|
||||
"hrp": "rdge",
|
||||
"bip44": 3,
|
||||
"bip44": 1,
|
||||
"min_amount": 100000,
|
||||
"max_amount": 10000000 * COIN,
|
||||
},
|
||||
|
||||
@@ -1296,7 +1296,7 @@ class BTCInterface(Secp256k1Interface):
|
||||
|
||||
def getWalletTransaction(self, txid: bytes):
|
||||
try:
|
||||
return bytes.fromhex(self.rpc_wallet("gettransaction", [txid.hex()]))
|
||||
return bytes.fromhex(self.rpc_wallet("gettransaction", [txid.hex()])["hex"])
|
||||
except Exception as e: # noqa: F841
|
||||
# TODO: filter errors
|
||||
return None
|
||||
@@ -1466,7 +1466,6 @@ class BTCInterface(Secp256k1Interface):
|
||||
vout: int = -1,
|
||||
):
|
||||
# Add watchonly address and rescan if required
|
||||
|
||||
if not self.isAddressMine(dest_address, or_watch_only=True):
|
||||
self.importWatchOnlyAddress(dest_address, "bid")
|
||||
self._log.info("Imported watch-only addr: {}".format(dest_address))
|
||||
|
||||
@@ -7,7 +7,16 @@
|
||||
|
||||
from .btc import BTCInterface
|
||||
from basicswap.chainparams import Coins
|
||||
from basicswap.rpc import make_rpc_func
|
||||
from basicswap.util.crypto import hash160
|
||||
|
||||
from basicswap.contrib.test_framework.script import (
|
||||
CScript,
|
||||
OP_DUP,
|
||||
OP_CHECKSIG,
|
||||
OP_HASH160,
|
||||
OP_EQUAL,
|
||||
OP_EQUALVERIFY,
|
||||
)
|
||||
|
||||
|
||||
class DOGEInterface(BTCInterface):
|
||||
@@ -15,29 +24,35 @@ class DOGEInterface(BTCInterface):
|
||||
def coin_type():
|
||||
return Coins.DOGE
|
||||
|
||||
@staticmethod
|
||||
def xmr_swap_b_lock_spend_tx_vsize() -> int:
|
||||
return 192
|
||||
|
||||
def __init__(self, coin_settings, network, swap_client=None):
|
||||
super(DOGEInterface, self).__init__(coin_settings, network, swap_client)
|
||||
# No multiwallet support
|
||||
self.rpc_wallet = make_rpc_func(
|
||||
self._rpcport, self._rpcauth, host=self._rpc_host
|
||||
|
||||
def getScriptDest(self, script: bytearray) -> bytearray:
|
||||
# P2SH
|
||||
|
||||
script_hash = hash160(script)
|
||||
assert len(script_hash) == 20
|
||||
|
||||
return CScript([OP_HASH160, script_hash, OP_EQUAL])
|
||||
|
||||
def getScriptForPubkeyHash(self, pkh: bytes) -> bytearray:
|
||||
# Return P2PKH
|
||||
return CScript([OP_DUP, OP_HASH160, pkh, OP_EQUALVERIFY, OP_CHECKSIG])
|
||||
|
||||
def encodeScriptDest(self, script_dest: bytes) -> str:
|
||||
# Extract hash from script
|
||||
script_hash = script_dest[2:-1]
|
||||
return self.sh_to_address(script_hash)
|
||||
|
||||
def getBLockSpendTxFee(self, tx, fee_rate: int) -> int:
|
||||
add_bytes = 107
|
||||
size = len(tx.serialize_with_witness()) + add_bytes
|
||||
pay_fee = round(fee_rate * size / 1000)
|
||||
self._log.info(
|
||||
f"BLockSpendTx fee_rate, size, fee: {fee_rate}, {size}, {pay_fee}."
|
||||
)
|
||||
|
||||
def initialiseWallet(self, key):
|
||||
# load with -hdseed= parameter
|
||||
pass
|
||||
|
||||
def checkWallets(self) -> int:
|
||||
return 1
|
||||
|
||||
def getNewAddress(self, use_segwit, label="swap_receive"):
|
||||
return self.rpc("getnewaddress", [label])
|
||||
|
||||
def isWatchOnlyAddress(self, address):
|
||||
addr_info = self.rpc("validateaddress", [address])
|
||||
return addr_info["iswatchonly"]
|
||||
|
||||
def isAddressMine(self, address: str, or_watch_only: bool = False) -> bool:
|
||||
addr_info = self.rpc("validateaddress", [address])
|
||||
if not or_watch_only:
|
||||
return addr_info["ismine"]
|
||||
return addr_info["ismine"] or addr_info["iswatchonly"]
|
||||
return pay_fee
|
||||
|
||||
Reference in New Issue
Block a user