Page MenuHomePhabricator

Do not import private keys to wallets with private keys disabled
ClosedPublic

Authored by deadalnix on Jan 7 2020, 15:37.

Details

Summary
  • tests: unify RPC argument to cli argument conversion and handle dicts and lists

When running tests with --usecli, unify the conversion from argument objects to
strings using a new function arg_to_cli(). This fixes boolean arguments when
using named arguments.

Also use json.dumps() to get the string values for arguments that are dicts and
lists so that bitcoind's JSON parser does not become confused.

  • Refactor importwallet to extract data from the file and then import

Instead of importing keys and scripts as each line in the file is
read, first extract the data then import them.

  • Do not import private keys to wallets with private keys disabled

This is a backport of Core PR15235

Test Plan
make check
./test/functional/test_runner.py

Diff Detail

Repository
rABC Bitcoin ABC
Branch
pr15235
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 8802
Build 15583: Default Diff Build & Tests
Build 15582: arc lint + arc unit

Event Timeline

Fabien requested changes to this revision.Jan 8 2020, 08:19
Fabien added a subscriber: Fabien.
Fabien added inline comments.
src/wallet/rpcdump.cpp
117 ↗(On Diff #15194)

Good catch !

727 ↗(On Diff #15194)

Nit: comment on it's own line

732 ↗(On Diff #15194)

Nit: use c++ constructor

738 ↗(On Diff #15194)

Dito

761 ↗(On Diff #15194)

Braces

769 ↗(On Diff #15194)

Nit: c++ constructor

This revision now requires changes to proceed.Jan 8 2020, 08:19
Fabien added inline comments.
src/wallet/rpcdump.cpp
677

Slightly out of scope, but while you're at it there these casts can also be constructors

This revision is now accepted and ready to land.Jan 9 2020, 09:11