Comparing version 1.2.2 to 1.3.0
@@ -17,4 +17,2 @@ var util = require('util'); | ||
this.call = function(method, params, callback, errback, path) { | ||
var client = http.createClient(port, host); | ||
var clientRequestErrorCalled = false; | ||
@@ -28,28 +26,23 @@ // First we encode the request into JSON | ||
var headers = {}; | ||
// prepare request options | ||
var requestOptions = { | ||
host: host, | ||
port: port, | ||
method: 'POST', | ||
path: path || '/', | ||
headers: { | ||
'Host': host, | ||
'Content-Length': requestJSON.length | ||
} | ||
}; | ||
// use HTTP auth if user and password set | ||
if (user && password) { | ||
var buff = new Buffer(this.user + ":" + this.password) | ||
.toString('base64'); | ||
var auth = 'Basic ' + buff; | ||
headers['Authorization'] = auth; | ||
requestOptions.auth = this.user + ':' + this.password; | ||
} | ||
// Then we build some basic headers. | ||
headers['Host'] = host; | ||
headers['Content-Length'] = requestJSON.length; | ||
// Now we'll make a request to the server | ||
var request = client.request('POST', path || '/', headers); | ||
request.write(requestJSON); | ||
var request = http.request(requestOptions); | ||
function clientRequestErrorHandler(e) { | ||
if (!clientRequestErrorCalled) { | ||
clientRequestErrorCalled = true; | ||
errback(e); | ||
} | ||
} | ||
client.on('error', clientRequestErrorHandler); | ||
request.on('error', clientRequestErrorHandler); | ||
request.on('error', errback); | ||
@@ -107,2 +100,4 @@ request.on('response', function(response) { | ||
}); | ||
request.write(requestJSON); | ||
request.end(); | ||
}; | ||
@@ -109,0 +104,0 @@ } |
{ | ||
"name": "bitcoin", | ||
"description": "Communicate with bitcoind via JSON-RPC", | ||
"version": "1.2.2", | ||
"version": "1.3.0", | ||
"main": "./lib/bitcoin", | ||
@@ -11,2 +11,5 @@ "keywords": [ | ||
"author": "Bill Casarin <bill@casarin.ca> (jb55.com)", | ||
"contributors": [ | ||
"Sean Lavine <sean@eternalrise.com>" | ||
], | ||
"dependencies": { | ||
@@ -23,3 +26,3 @@ "underscore": "1.3.x" | ||
"engines": { | ||
"node": ">=0.2.6" | ||
"node": ">= 0.6.0 < 0.9.0" | ||
}, | ||
@@ -30,2 +33,2 @@ "scripts": { | ||
"optionalDependencies": {} | ||
} | ||
} |
@@ -11,3 +11,3 @@ This is a private, difficulty 1 testnet in a box. | ||
$ make getinfo | ||
bitcoind -datadir=1 getinfo | ||
bitcoind -datadir=1 getinfo | ||
{ | ||
@@ -17,4 +17,4 @@ "version" : 60006, | ||
"walletversion" : 60000, | ||
"balance" : 0.00000000, | ||
"blocks" : 0, | ||
"balance" : 550.00000000, | ||
"blocks" : 130, | ||
"connections" : 1, | ||
@@ -24,3 +24,3 @@ "proxy" : "", | ||
"testnet" : true, | ||
"keypoololdest" : 1335395484, | ||
"keypoololdest" : 1335827404, | ||
"keypoolsize" : 101, | ||
@@ -30,3 +30,3 @@ "paytxfee" : 0.00000000, | ||
} | ||
bitcoind -datadir=2 getinfo | ||
bitcoind -datadir=2 getinfo | ||
{ | ||
@@ -37,3 +37,3 @@ "version" : 60006, | ||
"balance" : 0.00000000, | ||
"blocks" : 0, | ||
"blocks" : 130, | ||
"connections" : 1, | ||
@@ -43,3 +43,3 @@ "proxy" : "", | ||
"testnet" : true, | ||
"keypoololdest" : 1335395484, | ||
"keypoololdest" : 1335826149, | ||
"keypoolsize" : 101, | ||
@@ -50,3 +50,2 @@ "paytxfee" : 0.00000000, | ||
To start generating blocks: | ||
@@ -65,3 +64,3 @@ | ||
To clean up any files created while running the testnet | ||
(and restore to new, original state): | ||
(and restore to the original state of 130 blocks) | ||
@@ -68,0 +67,0 @@ $ make clean |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 6 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
432488
25
522
1
7