Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13115891
D9934.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Subscribers
None
D9934.diff
View Options
diff --git a/test/functional/abc_p2p_avalanche_peer_discovery.py b/test/functional/abc_p2p_avalanche_peer_discovery.py
--- a/test/functional/abc_p2p_avalanche_peer_discovery.py
+++ b/test/functional/abc_p2p_avalanche_peer_discovery.py
@@ -17,7 +17,6 @@
get_proof_ids,
)
from test_framework.key import (
- bytes_to_wif,
ECKey,
ECPubKey,
)
@@ -36,6 +35,7 @@
assert_equal,
wait_until,
)
+from test_framework.wallet_util import bytes_to_wif
UNCONDITIONAL_RELAY_DELAY = 2 * 60
diff --git a/test/functional/abc_p2p_proof_inventory.py b/test/functional/abc_p2p_proof_inventory.py
--- a/test/functional/abc_p2p_proof_inventory.py
+++ b/test/functional/abc_p2p_proof_inventory.py
@@ -12,7 +12,7 @@
wait_for_proof,
)
from test_framework.address import ADDRESS_ECREG_UNSPENDABLE
-from test_framework.key import ECKey, bytes_to_wif
+from test_framework.key import ECKey
from test_framework.messages import (
AvalancheProof,
CInv,
@@ -33,6 +33,7 @@
connect_nodes,
wait_until,
)
+from test_framework.wallet_util import bytes_to_wif
import time
diff --git a/test/functional/abc_rpc_avalancheproof.py b/test/functional/abc_rpc_avalancheproof.py
--- a/test/functional/abc_rpc_avalancheproof.py
+++ b/test/functional/abc_rpc_avalancheproof.py
@@ -13,7 +13,7 @@
get_proof_ids,
wait_for_proof,
)
-from test_framework.key import ECKey, bytes_to_wif
+from test_framework.key import ECKey
from test_framework.messages import (
AvalancheDelegation,
AvalancheDelegationLevel,
@@ -30,6 +30,7 @@
wait_until,
assert_raises_rpc_error,
)
+from test_framework.wallet_util import bytes_to_wif
AVALANCHE_MAX_PROOF_STAKES = 1000
diff --git a/test/functional/p2p_eviction.py b/test/functional/p2p_eviction.py
--- a/test/functional/p2p_eviction.py
+++ b/test/functional/p2p_eviction.py
@@ -17,7 +17,7 @@
from test_framework.avatools import AvaP2PInterface, create_coinbase_stakes
from test_framework.blocktools import create_block, create_coinbase
-from test_framework.key import ECKey, bytes_to_wif
+from test_framework.key import ECKey
from test_framework.messages import (
AvalancheProof,
CTransaction,
@@ -29,6 +29,7 @@
from test_framework.p2p import P2PDataStore, P2PInterface
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import assert_equal, wait_until
+from test_framework.wallet_util import bytes_to_wif
class SlowP2PDataStore(P2PDataStore):
diff --git a/test/functional/p2p_inv_download.py b/test/functional/p2p_inv_download.py
--- a/test/functional/p2p_inv_download.py
+++ b/test/functional/p2p_inv_download.py
@@ -8,7 +8,7 @@
from test_framework.address import ADDRESS_ECREG_UNSPENDABLE
from test_framework.avatools import wait_for_proof
-from test_framework.key import ECKey, bytes_to_wif
+from test_framework.key import ECKey
from test_framework.messages import (
AvalancheProof,
CInv,
@@ -31,6 +31,7 @@
assert_raises_rpc_error,
wait_until,
)
+from test_framework.wallet_util import bytes_to_wif
import functools
import time
diff --git a/test/functional/rpc_createmultisig.py b/test/functional/rpc_createmultisig.py
--- a/test/functional/rpc_createmultisig.py
+++ b/test/functional/rpc_createmultisig.py
@@ -3,20 +3,19 @@
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test multisig RPCs"""
+import binascii
+import decimal
+import itertools
+import json
+import os
from test_framework.descriptors import descsum_create, drop_origins
+from test_framework.key import ECPubKey
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
assert_raises_rpc_error,
assert_equal,
)
-from test_framework.key import ECPubKey
-
-import binascii
-import decimal
-import itertools
-import json
-import os
class RpcCreateMultiSigTest(BitcoinTestFramework):
diff --git a/test/functional/test_framework/key.py b/test/functional/test_framework/key.py
--- a/test/functional/test_framework/key.py
+++ b/test/functional/test_framework/key.py
@@ -12,8 +12,6 @@
import hashlib
import random
-from .address import byte_to_base58
-
def modinv(a, n):
"""Compute the modular inverse of a modulo n
@@ -423,16 +421,3 @@
assert pubkey.verify_schnorr(sig, msg32)
return sig
-
-
-def bytes_to_wif(b, compressed=True):
- if compressed:
- b += b'\x01'
- return byte_to_base58(b, 239)
-
-
-def generate_wif_key():
- # Makes a WIF privkey for imports
- k = ECKey()
- k.generate()
- return bytes_to_wif(k.get_bytes(), k.is_compressed)
diff --git a/test/functional/test_framework/wallet_util.py b/test/functional/test_framework/wallet_util.py
--- a/test/functional/test_framework/wallet_util.py
+++ b/test/functional/test_framework/wallet_util.py
@@ -6,13 +6,11 @@
from collections import namedtuple
from test_framework.address import (
+ byte_to_base58,
key_to_p2pkh,
script_to_p2sh,
)
-from test_framework.key import (
- bytes_to_wif,
- ECKey,
-)
+from test_framework.key import ECKey
from test_framework.script import (
CScript,
OP_2,
@@ -101,3 +99,16 @@
raise AssertionError(
"key {} value {} did not match expected value {}".format(
key, addr_info[key], value))
+
+
+def bytes_to_wif(b, compressed=True):
+ if compressed:
+ b += b'\x01'
+ return byte_to_base58(b, 239)
+
+
+def generate_wif_key():
+ # Makes a WIF privkey for imports
+ k = ECKey()
+ k.generate()
+ return bytes_to_wif(k.get_bytes(), k.is_compressed)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Mar 1, 12:33 (24 m, 28 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5187855
Default Alt Text
D9934.diff (5 KB)
Attached To
D9934: [tests] move generate_wif_key to wallet_util.py
Event Timeline
Log In to Comment