Skip to content

Importmulti not properly encoded #123

@sandrich

Description

@sandrich

The optional second parameter is not encoded into JSON. While you create a BuildJson you never use it

return self._node._rpc.call("importmulti", requests, rescan)

To add on it. if there is a rescan you might get

Traceback (most recent call last):
  File "/Users/sanc/dev/pricing/t1.py", line 166, in <module>
    defichain.node.wallet.importmulti(addresses, True)
  File "/opt/homebrew/lib/python3.9/site-packages/defichain/node/modules/wallet.py", line 688, in importmulti
    return self._node._rpc.call("importmulti", requests)
  File "/opt/homebrew/lib/python3.9/site-packages/defichain/node/rpc.py", line 57, in call
    RPCErrorHandler(response, self._logger)  # Check for Exceptions
  File "/opt/homebrew/lib/python3.9/site-packages/defichain/node/RPCErrorHandler.py", line 57, in __init__
    raise InternalServerError(f"{rpc_name}: {msg}")
defichain.exceptions.http.InternalServerError.InternalServerError: InternalServerError(500): RPC_WALLET_ERROR: Wallet is currently rescanning. Abort existing rescan or wait.

Since a rescan can take hours it is best to end here. Scan status could be queried via getwalletinfo returning

{
  "walletname": "wallet.dat",
  "walletversion": 169900,
  "balance": 0,
  "unconfirmed_balance": 0,
  "immature_balance": 0,
  "txcount": 11171,
  "keypoololdest": 1659528052,
  "keypoolsize": 1000,
  "keypoolsize_hd_internal": 1000,
  "unlocked_until": 1697190990,
  "paytxfee": 0,
  "hdseedid": "016ee430f1b4b890cfead20ae2a7ead2b7db3962",
  "private_keys_enabled": true,
  "avoid_reuse": false,
  "scanning": {
    "duration": 301,
    "progress": 0.6400052290130125
  }
}

Metadata

Metadata

Assignees

Labels

area:packagePython PackagebugSomething isn't workingpackage:nodePython Package Node / RPC API

Projects

Status

Released

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions