testing: cope with bitcoin core v30
This commit is contained in:
parent
8e3bbfdf84
commit
38616234e7
@ -33,6 +33,7 @@ class Bitcoind:
|
||||
self.userpass = None
|
||||
self.supply_wallet = None
|
||||
self.has_bdb = True
|
||||
self.version = None
|
||||
|
||||
def start(self):
|
||||
|
||||
@ -51,7 +52,8 @@ class Bitcoind:
|
||||
[
|
||||
self.bitcoind_path,
|
||||
# needed for newest master
|
||||
# TODO legacy wallet will be deprecated in 29
|
||||
# legacy wallet was deprecated in v29
|
||||
# and removed completely in v30
|
||||
"-deprecatedrpc=create_bdb",
|
||||
"-regtest",
|
||||
f"-datadir={self.datadir}",
|
||||
@ -91,12 +93,14 @@ class Bitcoind:
|
||||
pass
|
||||
|
||||
assert self.rpc.getblockchaininfo()['chain'] == 'regtest'
|
||||
assert self.rpc.getnetworkinfo()['version'] >= 220000, "we require >= 22.0 of Core"
|
||||
self.version = self.rpc.getnetworkinfo()['version']
|
||||
assert self.version >= 220000, "we require >= 22.0 of Core"
|
||||
# not descriptors so that we can do dumpwallet
|
||||
try:
|
||||
self.supply_wallet = self.create_wallet(wallet_name="supply", descriptors=False)
|
||||
except JSONRPCException as e:
|
||||
assert "BDB wallet creation is deprecated" in str(e)
|
||||
assert "BDB wallet creation is deprecated" in str(e) \
|
||||
or "no longer possible to create a legacy wallet" in str(e) # before v30.0 vs v30.0+
|
||||
self.has_bdb = False
|
||||
self.supply_wallet = self.create_wallet(wallet_name="supply", descriptors=True)
|
||||
|
||||
@ -172,8 +176,9 @@ def match_key(bitcoind, set_master_key, reset_seed_words):
|
||||
|
||||
os.unlink(fn)
|
||||
except JSONRPCException as e:
|
||||
print(str(e))
|
||||
assert "Only legacy wallets are supported by this command" in str(e)
|
||||
assert "Only legacy wallets are supported by this command" in str(e) \
|
||||
or "Method not found" in str(e) # v30.0
|
||||
|
||||
prv_descs = bitcoind.supply_wallet.listdescriptors(True) # True --> show private
|
||||
prv = prv_descs["descriptors"][0]["desc"].replace("pkh(", "").split("/")[0]
|
||||
|
||||
|
||||
@ -1863,7 +1863,7 @@ def test_op_return_signing(op_return_data, dev, fake_txn, bitcoind_d_sim_watch,
|
||||
# tx = cc.finalizepsbt(base64.b64encode(signed).decode())["hex"]
|
||||
res = cc.testmempoolaccept([tx])[0]
|
||||
|
||||
if len(op_return_data) > 80:
|
||||
if (bitcoind.version < 300000) and (len(op_return_data) > 80):
|
||||
# policy
|
||||
assert res["allowed"] is False
|
||||
assert res["reject-reason"] == "scriptpubkey"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user