-
Notifications
You must be signed in to change notification settings - Fork 38.1k
Closed
Labels
Description
A call to loadwallet while bitcoin-qt is starting will cause a crash:
Process 77611 launched: '/Users/michael/github/bitcoin/src/qt/bitcoin-qt' (x86_64)
2019-09-23 07:40:29.799378+0800 bitcoin-qt[77611:495185] MessageTracer: Falling back to default whitelist
Process 77611 stopped
* thread #12, name = 'bitcoin-httpworker.0', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
frame #0: 0x00000001001faaa0 bitcoin-qt`WalletController::getOrCreateWallet(this=0x000000011a5a1670, wallet=unique_ptr<interfaces::Wallet, std::__1::default_delete<interfaces::Wallet> > @ 0x0000700009586200) at walletcontroller.cpp:96:36
93
94 // Return model instance if exists.
95 if (!m_wallets.empty()) {
-> 96 std::string name = wallet->getWalletName();
97 for (WalletModel* wallet_model : m_wallets) {
98 if (wallet_model->wallet().getWalletName() == name) {
99 return wallet_model;
Target 0: (bitcoin-qt) stopped.import argparse
import time
import os
import sys
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
# lldb src/qt/bitcoin-qt -- -debug -regtest
# python3 crash.py <datadir>
parser = argparse.ArgumentParser()
parser.add_argument('datadir')
args = parser.parse_args()
cookie: str = args.datadir + '/regtest/.cookie'
wallet_name: str = 'hello'
# Wait for cookie file to be created
while not os.path.exists(cookie):
time.sleep(0.5)
# Read .cookie file to get user and pass
with open(cookie) as f:
userpass: str = f.readline().lstrip().rstrip()
rpc = AuthServiceProxy('http://{}@127.0.0.1:18443'.format(userpass))
# Wait for bitcoin-qt to be ready
ready: bool = False
while not ready:
print('waiting...')
try:
rpc.getblockchaininfo()
ready = True
except Exception:
time.sleep(0.5)
pass
rpc.loadwallet(wallet_name)