diff --git a/README.md b/README.md index c10d9859..5feacc5d 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,10 @@ bitcoind.getBlock(blockHash, function(err, block) { } ``` +bitcoind.stop(function(err, result) { + // bitcoind is stopped +}); + You can log output from the daemon using: ``` bash diff --git a/integration/index.js b/integration/index.js index 16604514..2eb4160b 100644 --- a/integration/index.js +++ b/integration/index.js @@ -38,6 +38,13 @@ describe('Basic Functionality', function() { }); + after(function(done) { + this.timeout(20000); + bitcoind.stop(function(err, result) { + done(); + }); + }); + describe('will get correct block data', function() { blockData.forEach(function(data) { diff --git a/src/bitcoindjs.cc b/src/bitcoindjs.cc index 477bd5c2..3611d043 100644 --- a/src/bitcoindjs.cc +++ b/src/bitcoindjs.cc @@ -716,6 +716,9 @@ async_stop_node(uv_work_t *req) { async_node_data *data = static_cast(req->data); unhook_packets(); StartShutdown(); + while(!shutdown_complete) { + usleep(1E6); + } data->result = std::string("bitcoind shutdown."); }