Skip to content

Commit

Permalink
Merge pull request #729 from pinheadmz/backend
Browse files Browse the repository at this point in the history
Quit if native bcrypto bindings are missing
  • Loading branch information
braydonf committed Oct 31, 2019
2 parents f991b0a + d553f0a commit 77d8804
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
17 changes: 17 additions & 0 deletions bin/node
Expand Up @@ -19,6 +19,23 @@ if (process.argv.indexOf('--version') !== -1
throw new Error('Could not exit.');
}

const sha256 = require('bcrypto/lib/sha256');
const secp256k1 = require('bcrypto/lib/secp256k1');

if (sha256.native !== 2) {
console.error('Bindings for bcrypto were not built.');
console.error('Please build them before continuing.');
process.exit(1);
return;
}

if (secp256k1.native !== 2) {
console.error('Bindings for libsecp256k1 were not built.');
console.error('Please build them before continuing.');
process.exit(1);
return;
}

const FullNode = require('../lib/node/fullnode');

const node = new FullNode({
Expand Down
17 changes: 17 additions & 0 deletions bin/spvnode
Expand Up @@ -8,6 +8,23 @@ const assert = require('assert');
const SPVNode = require('../lib/node/spvnode');
const Outpoint = require('../lib/primitives/outpoint');

const sha256 = require('bcrypto/lib/sha256');
const secp256k1 = require('bcrypto/lib/secp256k1');

if (sha256.native !== 2) {
console.error('Bindings for bcrypto were not built.');
console.error('Please build them before continuing.');
process.exit(1);
return;
}

if (secp256k1.native !== 2) {
console.error('Bindings for libsecp256k1 were not built.');
console.error('Please build them before continuing.');
process.exit(1);
return;
}

const node = new SPVNode({
file: true,
argv: true,
Expand Down

0 comments on commit 77d8804

Please sign in to comment.