ruimarinho / bitcoin-core

A modern Bitcoin Core REST and RPC client.
477 stars 186 forks source link

WalletPassphrase fails #102

Closed tommyjs007 closed 4 years ago

tommyjs007 commented 4 years ago

My client is initialized with wallet, however walletPassphrase doesn't pass rpcwallet parameter.

Wallet file not specified (must request wallet RPC through /wallet/<filename> uri-path).","code":-19,"name":"RpcError","level":"info","stack":"RpcError: Wallet file not specified (must request wallet RPC through /wallet/<filename> uri-path).\n at getRpcResult (/usr/src/app/node_modules/bitcoin-core/dist/src/parser.js:39:11)\n at Client.rpc (/usr/src/app/node_modules/bitcoin-core/dist/src/parser.js:82:14)\n at Client.tryCatcher (/usr/src/app/node_modules/bluebird/js/release/util.js:16:23)\n at Promise._settlePromiseFromHandler (/usr/src/app/node_modules/bluebird/js/release/promise.js:517:31)\n at Promise._settlePromise (/usr/src/app/node_modules/bluebird/js/release/promise.js:574:18)\n at Promise._settlePromise0 (/usr/src/app/node_modules/bluebird/js/release/promise.js:619:10)\n at Promise._settlePromises (/usr/src/app/node_modules/bluebird/js/release/promise.js:699:18)\n at Promise._fulfill (/usr/src/app/node_modules/bluebird/js/release/promise.js:643:18)\n at Request._callback (/usr/src/app/node_modules/bluebird/js/release/nodeback.js:45:21)\n at Request.self.callback (/usr/src/app/node_modules/request/request.js:185:22)\n at Request.emit (events.js:203:15)\n at Request.EventEmitter.emit (domain.js:448:20)\n at Request.<anonymous> (/usr/src/app/node_modules/request/request.js:1161:10)\n at Request.emit (events.js:198:13)\n at Request.EventEmitter.emit (domain.js:448:20)\n at IncomingMessage.<anonymous> (/usr/src/app/node_modules/request/request.js:1083:12)\n at Object.onceWrapper (events.js:286:20)\n at IncomingMessage.emit (events.js:203:15)\n at IncomingMessage.EventEmitter.emit (domain.js:448:20)\n at endReadableNT (_stream_readable.js:1129:12)\n at process._tickCallback (internal/process/next_tick.js:63:19)"}

pedrobranco commented 4 years ago

Hello. Can you provide the setup of the bitcoin-core client?

tommyjs007 commented 4 years ago

@pedrobranco bitcoin.conf

regtest=1 daemon=1 txindex=1

Just a bit more information. My code looks similar to this one.

 const client = new BitcoinClient({
      network,
      username,
      password,
      port,
      wallet
    });

// fails
await client.walletPassphrase("test");
pedrobranco commented 4 years ago

@lokoArt Call this and check against the wallet argument.

console.log(await client.listWallets())

Also, does the client work for other non-wallet methods?

tommyjs007 commented 4 years ago

@pedrobranco sorry for such a late reply again. But yes, it passes. As a matter of fact I do load that encrypted wallet with client.loadwallet

pedrobranco commented 4 years ago

I will need more information / logs. Run with environment variable DEBUG=*, remove the sensitive data and post it here.

tommyjs007 commented 4 years ago

Pardon, my bad. Just updated the library to 3.0.0 and the bug disappeared!