From dce9e2591987eef03ba32de1ca8629fb13574a3e Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Mon, 3 Jul 2023 12:42:49 +0000 Subject: [PATCH] rpc_init(): skip tw initialization where possible --- examples/coin-daemon-info.py | 2 +- examples/halving-calculator.py | 2 +- examples/whitepaper.py | 2 +- mmgen/autosign.py | 4 ++-- mmgen/main_txsign.py | 2 +- mmgen/msg.py | 4 ++-- test/unit_tests_d/ut_tx_deserialize.py | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/coin-daemon-info.py b/examples/coin-daemon-info.py index 00faa530..c3207954 100755 --- a/examples/coin-daemon-info.py +++ b/examples/coin-daemon-info.py @@ -45,7 +45,7 @@ from mmgen.util import make_timestr async def get_rpc(cfg): try: - return await rpc_init(cfg) + return await rpc_init( cfg, ignore_wallet=True ) except SocketError as e: return False diff --git a/examples/halving-calculator.py b/examples/halving-calculator.py index 9e60c9b2..e194637b 100755 --- a/examples/halving-calculator.py +++ b/examples/halving-calculator.py @@ -59,7 +59,7 @@ async def main(): proto = cfg._proto from mmgen.rpc import rpc_init - c = await rpc_init(cfg,proto) + c = await rpc_init( cfg, proto, ignore_wallet=True ) tip = await c.call('getblockcount') assert tip > 1, 'block tip must be > 1' diff --git a/examples/whitepaper.py b/examples/whitepaper.py index 62643f59..3111f996 100755 --- a/examples/whitepaper.py +++ b/examples/whitepaper.py @@ -25,7 +25,7 @@ async def main(): assert cfg.coin == 'BTC' and cfg.network == 'mainnet', 'This script works only on BTC mainnet!' - c = await rpc_init(cfg) + c = await rpc_init( cfg, ignore_wallet=True ) tx = await c.call('getrawtransaction',txid,True) diff --git a/mmgen/autosign.py b/mmgen/autosign.py index ae3a845e..ccbf155d 100755 --- a/mmgen/autosign.py +++ b/mmgen/autosign.py @@ -79,7 +79,7 @@ class Signable: tx1 = UnsignedTX( cfg=self.cfg, filename=f ) if tx1.proto.sign_mode == 'daemon': from .rpc import rpc_init - tx1.rpc = await rpc_init( self.cfg, tx1.proto ) + tx1.rpc = await rpc_init( self.cfg, tx1.proto, ignore_wallet=True ) from .tx.sign import txsign tx2 = await txsign( self.cfg, tx1, self.parent.wallet_files[:], None, None ) if tx2: @@ -293,7 +293,7 @@ class Autosign: from .rpc import rpc_init from .exception import SocketError try: - await rpc_init( self.cfg, proto ) + await rpc_init( self.cfg, proto, ignore_wallet=True ) except SocketError as e: from .daemon import CoinDaemon d = CoinDaemon( self.cfg, proto=proto, test_suite=self.cfg.test_suite ) diff --git a/mmgen/main_txsign.py b/mmgen/main_txsign.py index 5161f8f4..065256bb 100755 --- a/mmgen/main_txsign.py +++ b/mmgen/main_txsign.py @@ -137,7 +137,7 @@ async def main(): if tx1.proto.sign_mode == 'daemon': from .rpc import rpc_init - tx1.rpc = await rpc_init(cfg,tx1.proto) + tx1.rpc = await rpc_init( cfg, tx1.proto, ignore_wallet=True ) if cfg.tx_id: msg(tx1.txid) diff --git a/mmgen/msg.py b/mmgen/msg.py index 3e388bca..9035fecd 100755 --- a/mmgen/msg.py +++ b/mmgen/msg.py @@ -251,7 +251,7 @@ class coin_msg: if self.proto.sign_mode == 'daemon': from .rpc import rpc_init - self.rpc = await rpc_init(self.cfg,self.proto) + self.rpc = await rpc_init( self.cfg, self.proto, ignore_wallet=True ) from .wallet import Wallet from .addrlist import KeyAddrList @@ -315,7 +315,7 @@ class coin_msg: if self.proto.sign_mode == 'daemon': from .rpc import rpc_init - self.rpc = await rpc_init(self.cfg,self.proto) + self.rpc = await rpc_init( self.cfg, self.proto, ignore_wallet=True ) for k,v in sigs.items(): ret = await self.do_verify( diff --git a/test/unit_tests_d/ut_tx_deserialize.py b/test/unit_tests_d/ut_tx_deserialize.py index ca31f9c6..1c50a678 100755 --- a/test/unit_tests_d/ut_tx_deserialize.py +++ b/test/unit_tests_d/ut_tx_deserialize.py @@ -34,7 +34,7 @@ async def test_tx(tx_proto,tx_hex,desc,n): return True return False - rpc = await rpc_init( cfg, proto=tx_proto ) + rpc = await rpc_init( cfg, proto=tx_proto, ignore_wallet=True ) d = await rpc.call('decoderawtransaction',tx_hex) if has_nonstandard_outputs(d['vout']): return False