Getting an error Unknown Network running a bcoin node, but I'm not sure what's causing it since I'm defining the network very quickly.

Error Message:

(node:10579) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Unknown network.
(node:10579) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Here is the bcoin script

var bcoin = require('bcoin').set('testnet');

(async () => {
  var full = new bcoin.node.FullNode({
    network: bcoin.network.get().toString(),
    httpPort: 18332,
    httpHost: '127.0.0.1',
    bip37: true,
    listen: true,
    passphrase: "secret",
    logLevel: "info",
    loader: require
  });

  if (!full.config.bool('no-wallet') && !full.has('walletdb')) {
    const plugin = require('/Users/<user>/Projects/bcoin/lib/wallet/plugin');
    full.use(plugin);
  }
  await full.open();


  setUpWalletWatcher(full.pool, full.walletdb);
  await full.connect();
  await full.http.open();

  full.startSync();

})();
up vote 0 down vote accepted

I fixed it by simply instantiating the fullnode object outside of the async block

var full = new bcoin.node.FullNode({
   network: "testnet",
   httpPort: 18332,
   prefix: '~/.bcoin/testnet',
   httpHost: '127.0.0.1',
   bip37: true,
   listen: true,
   workers: true,
   passphrase: "secret",
   logLevel: "info",
   loader: require
});

(async () => {
   //do stuff
))();
bcoin.network.get().toString()

returns main which is not a valid network string, it should be one of mainnet testnet simnet or regtest.

  • Even changing the network to testnet didn't work – arshbot Dec 3 '17 at 3:11

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.