support Bitcoin Core v23.0.0

This commit is contained in:
The MMGen Project 2022-04-25 15:13:05 +00:00
commit 1ba11a71c1
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
4 changed files with 21 additions and 4 deletions

View file

@ -19,7 +19,7 @@ from ...util import list_gen
from ...daemon import CoinDaemon,_nw,_dd
class bitcoin_core_daemon(CoinDaemon):
daemon_data = _dd('Bitcoin Core', 220000, '22.0.0')
daemon_data = _dd('Bitcoin Core', 230000, '23.0.0')
exec_fn = 'bitcoind'
cli_fn = 'bitcoin-cli'
testnet_dir = 'testnet3'

View file

@ -78,6 +78,7 @@ class BitcoinRPCClient(RPCClient,metaclass=AsyncInit):
self.caps = ('full_node',)
for func,cap in (
('setlabel','label_api'),
('getdeploymentinfo','deployment_info'),
('signrawtransactionwithkey','sign_with_key') ):
if len((await self.call('help',func)).split('\n')) > 3:
self.caps += (cap,)
@ -87,14 +88,21 @@ class BitcoinRPCClient(RPCClient,metaclass=AsyncInit):
('getblockhash',(0,)),
('getnetworkinfo',()),
('getblockchaininfo',()),
]
] + (
[('getdeploymentinfo',())] if 'deployment_info' in self.caps else []
)
(
self.blockcount,
block0,
self.cached['networkinfo'],
self.cached['blockchaininfo'],
) = await self.gathered_call(None,tuple(call_group))
self.cached['deploymentinfo'],
) = (
await self.gathered_call(None,tuple(call_group))
) + (
[] if 'deployment_info' in self.caps else [None]
)
self.daemon_version = self.cached['networkinfo']['version']
self.daemon_version_str = self.cached['networkinfo']['subversion']
@ -180,6 +188,13 @@ class BitcoinRPCClient(RPCClient,metaclass=AsyncInit):
def info(self,info_id):
def segwit_is_active():
if 'deployment_info' in self.caps:
return (
self.cached['deploymentinfo']['deployments']['segwit']['active']
or ( g.test_suite and not os.getenv('MMGEN_TEST_SUITE_REGTEST') )
)
d = self.cached['blockchaininfo']
try:

View file

@ -1 +1 @@
13.1.dev24
13.1.dev25

View file

@ -294,12 +294,14 @@ class TestSuiteRegtest(TestSuiteBase,TestSuiteShared):
self.miner_wif = 'cTEkSYCWKvNo757uwFPd4yuCXsbZvfJDipHsHWFRapXpnikMHvgn'
os.environ['MMGEN_BOGUS_SEND'] = ''
os.environ['MMGEN_TEST_SUITE_REGTEST'] = '1'
self.write_to_tmpfile('wallet_password',rt_pw)
self.dfl_mmtype = 'C' if self.proto.coin == 'BCH' else 'B'
def __del__(self):
os.environ['MMGEN_BOGUS_SEND'] = '1'
os.environ['MMGEN_TEST_SUITE_REGTEST'] = ''
def _add_comments_to_addr_file(self,addrfile,outfile,use_labels=False):
silence()