Skip to content

Commit

Permalink
qa: finally get rid of python-bitcoinlib
Browse files Browse the repository at this point in the history
I'm surprised i didn't have an issue to mark as closed now. Maybe
mentioning revault#268 which is made largely easier with this.
  • Loading branch information
darosior committed Dec 3, 2021
1 parent 3ff23dc commit 7231b5d
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 13 deletions.
1 change: 0 additions & 1 deletion tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
python-bitcoinlib==0.11.0
pytest==6.2
pytest-xdist==1.31.0
pytest-timeout==1.3.4
Expand Down
5 changes: 2 additions & 3 deletions tests/test_framework/bitcoind.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import bitcoin
import logging
import os

from decimal import Decimal
from ephemeral_port_reserve import reserve
from test_framework.authproxy import AuthServiceProxy
from test_framework.utils import TailableProc, wait_for, TIMEOUT, BITCOIND_PATH
from test_framework.utils import TailableProc, wait_for, TIMEOUT, BITCOIND_PATH, COIN


class BitcoinDProxy:
Expand Down Expand Up @@ -59,7 +58,7 @@ def __init__(self, bitcoin_dir, rpcport=None):
"port": self.p2pport,
"rpcport": rpcport,
"debug": 1,
"fallbackfee": Decimal(1000) / bitcoin.core.COIN,
"fallbackfee": Decimal(1000) / COIN,
"rpcthreads": 32,
}
self.conf_file = os.path.join(bitcoin_dir, "bitcoin.conf")
Expand Down
9 changes: 2 additions & 7 deletions tests/test_framework/revault_network.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import bip32
import bitcoin
import logging
import os
import random

from bitcoin.wallet import CBitcoinSecret
from ephemeral_port_reserve import reserve
from nacl.public import PrivateKey as Curve25519Private
from test_framework import serializations
Expand All @@ -16,7 +14,6 @@
get_descriptors,
get_participants,
wait_for,
RpcError,
TIMEOUT,
WT_PLUGINS_DIR,
)
Expand Down Expand Up @@ -104,10 +101,8 @@ def deploy(
stks_xpubs, cosigs_keys, mans_xpubs, managers_threshold, cpfp_xpubs, csv
)
# Generate a dummy 2of2 to be used as our Emergency address
bitcoin.SelectParams("regtest")
pka = str(CBitcoinSecret.from_secret_bytes(os.urandom(32)))
pkb = str(CBitcoinSecret.from_secret_bytes(os.urandom(32)))
desc = f"wsh(multi(2,{pka},{pkb}))"
desc = "wsh(multi(2,cRE7qAArQYnFQK7S1gXFTArFT4UWvh8J2v2EUajRWXbWFvRzxoeF,\
cTzcgRCmHNqUqZuZgvCPLUDXXrQSoVQpZiXQZWQzsLEytcTr6iXi))"
checksum = self.bitcoind.rpc.getdescriptorinfo(desc)["checksum"]
desc = f"{desc}#{checksum}"
self.emergency_address = self.bitcoind.rpc.deriveaddresses(desc)[0]
Expand Down
3 changes: 3 additions & 0 deletions tests/test_framework/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@
WT_PLUGINS_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "wtplugins")


COIN = 10 ** 8


def wait_for(success, timeout=TIMEOUT, debug_fn=None):
"""
Run success() either until it returns True, or until the timeout is reached.
Expand Down
2 changes: 1 addition & 1 deletion tests/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
import pytest
import os

from bitcoin.core import COIN
from fixtures import *
from test_framework.utils import (
TailableProc,
POSTGRES_IS_SETUP,
RpcError,
wait_for,
COIN,
)


Expand Down
2 changes: 1 addition & 1 deletion tests/test_watchtowers.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import os
import pytest

from bitcoin.core import COIN
from fixtures import *
from test_framework.utils import (
wait_for,
POSTGRES_IS_SETUP,
WT_PLUGINS_DIR,
COIN,
)


Expand Down

0 comments on commit 7231b5d

Please sign in to comment.