regtest: create miner wallet from hardcoded seed (BTC-only)
This commit is contained in:
parent
b0644a4052
commit
36c6021ce2
2 changed files with 23 additions and 4 deletions
|
|
@ -39,6 +39,17 @@ def create_data_dir(data_dir):
|
|||
try: os.makedirs(data_dir)
|
||||
except: pass
|
||||
|
||||
def create_hdseed(proto):
|
||||
# cTqgRxqSER1iZ4SoUKhaXUF3PzEADyhjHPXf19KW78GGGW7RxSWz hdseed=1
|
||||
# addr=bcrt1q2lew38703pdzvq529hefsl9f9z9a3j3mxwt4f0
|
||||
# cPNPEyVQpX5H9MKDwt73BScKvDh3Kk8MMEGowneT2RKFZ7Dfh3FL label=
|
||||
# addr=bcrt1qy7hwy8jx7w7lmm8v63hur5xzvqqhcyk8w85v9h hdkeypath=m/0'/0'/0'
|
||||
from .tool import tool_api
|
||||
t = tool_api()
|
||||
t.init_coin(proto.coin,proto.network)
|
||||
t.addrtype = 'bech32'
|
||||
return t.hex2wif('babaeb1a'*8)
|
||||
|
||||
def cliargs_convert(args):
|
||||
def gen():
|
||||
for arg in args:
|
||||
|
|
@ -115,9 +126,17 @@ class MMGenRegtest(MMGenObject):
|
|||
await rpc.icall(
|
||||
'createwallet',
|
||||
wallet_name = user,
|
||||
blank = user != 'miner' or self.coin == 'btc',
|
||||
no_keys = user != 'miner',
|
||||
load_on_startup = False )
|
||||
|
||||
if self.coin == 'btc': # BCH,LTC refuse to set HD seed while in IBD
|
||||
await rpc.call(
|
||||
'sethdseed',
|
||||
True,
|
||||
create_hdseed(self.proto),
|
||||
wallet = 'miner' )
|
||||
|
||||
await self.generate(432,silent=True)
|
||||
|
||||
gmsg('Setup complete')
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ class CallSigs:
|
|||
class bitcoin_core:
|
||||
|
||||
@classmethod
|
||||
def createwallet(cls,wallet_name,no_keys=True,passphrase='',load_on_startup=True):
|
||||
def createwallet(cls,wallet_name,no_keys=True,blank=True,passphrase='',load_on_startup=True):
|
||||
"""
|
||||
Quirk: when --datadir is specified (even if standard), wallet is created directly in
|
||||
datadir, otherwise in datadir/wallets
|
||||
|
|
@ -219,7 +219,7 @@ class CallSigs:
|
|||
'createwallet',
|
||||
wallet_name, # 1. wallet_name
|
||||
no_keys, # 2. disable_private_keys
|
||||
no_keys, # 3. blank (no keys or seed)
|
||||
blank, # 3. blank (no keys or seed)
|
||||
passphrase, # 4. passphrase (empty string for non-encrypted)
|
||||
False, # 5. avoid_reuse (track address reuse)
|
||||
False, # 6. descriptors (native descriptor wallet)
|
||||
|
|
@ -229,12 +229,12 @@ class CallSigs:
|
|||
class litecoin_core(bitcoin_core):
|
||||
|
||||
@classmethod
|
||||
def createwallet(cls,wallet_name,no_keys=True,passphrase='',load_on_startup=True):
|
||||
def createwallet(cls,wallet_name,no_keys=True,blank=True,passphrase='',load_on_startup=True):
|
||||
return (
|
||||
'createwallet',
|
||||
wallet_name, # 1. wallet_name
|
||||
no_keys, # 2. disable_private_keys
|
||||
no_keys, # 3. blank (no keys or seed)
|
||||
blank, # 3. blank (no keys or seed)
|
||||
)
|
||||
|
||||
class bitcoin_cash_node(litecoin_core): pass
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue