Skip to content

Commit b89864d

Browse files
author
Chris Kleeschulte
committed
Merge branch 'blocks'
2 parents 97683d2 + a14de13 commit b89864d

File tree

98 files changed

+10951
-12638
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+10951
-12638
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,7 @@ bin/SHA256SUMS.asc
2727
regtest/data/node1/regtest
2828
regtest/data/node2/regtest
2929
regtest/data/node3/regtest
30+
bitcore-node.json*
31+
*.bak
32+
*.orig
33+
lib/services/insight-api

.jshintrc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222
"trailing": true,
2323
"undef": true,
2424
"unused": true,
25-
"maxparams": 4,
26-
"maxstatements": 15,
25+
"maxparams": 6,
26+
"maxstatements": 25,
2727
"maxcomplexity": 10,
28-
"maxdepth": 3,
29-
"maxlen": 120,
28+
"maxdepth": 4,
29+
"maxlen": 140,
3030
"multistr": true,
3131
"predef": [
3232
"after",
@@ -39,4 +39,4 @@
3939
"module",
4040
"require"
4141
]
42-
}
42+
}

.travis.yml

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,10 @@
1+
dist: trusty
12
sudo: false
23
language: node_js
3-
env:
4-
- CXX=g++-4.8 CC=gcc-4.8
5-
addons:
6-
apt:
7-
sources:
8-
- ubuntu-toolchain-r-test
9-
packages:
10-
- g++-4.8
11-
- gcc-4.8
12-
- libzmq3-dev
134
node_js:
14-
- "v0.10.25"
15-
- "v0.12.7"
16-
- "v4"
5+
- 8
176
script:
18-
- npm run regtest
19-
- npm run test
7+
- npm run coverage
208
- npm run jshint
219
after_success:
22-
- npm run coveralls
10+
- npm run coveralls

benchmarks/data/block-367238.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

benchmarks/data/block-367239.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

benchmarks/data/block-367240.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

benchmarks/index.js

Lines changed: 0 additions & 169 deletions
This file was deleted.

bitcore-node.json.sample

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"network": "livenet",
3+
"port": 3001,
4+
"datadir": "/tmp",
5+
"services": [
6+
"p2p",
7+
"db",
8+
"header",
9+
"block",
10+
"transaction",
11+
"timestamp",
12+
"mempool",
13+
"address"
14+
],
15+
"servicesConfig": {
16+
"p2p": {
17+
"peers": [
18+
{ "ip": { "v4": "<some trusted full node>" } }
19+
]
20+
}
21+
}
22+
}

contrib/printKeys.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
'use strict';
2+
3+
var levelup = require('levelup');
4+
var leveldown = require('leveldown');
5+
var Encoding = require('../lib/services/address/encoding');
6+
var dbPath = '/Users/chrisk/.bwdb/bitcore-node.db';
7+
var bitcore = require('bitcore-lib');
8+
var db = levelup(dbPath, {keyEncoding: 'binary', valueEncoding: 'binary'});
9+
10+
var prefix = new Buffer('0002', 'hex');
11+
var encoding = new Encoding(prefix);
12+
var address = '1MfDRRVVKXUe5KNVZzu8CBzUZDHTTYZM94';
13+
var addressLength = new Buffer(1);
14+
addressLength.writeUInt8(address.length);
15+
16+
//var startBuffer = prefix;
17+
//var endBuffer = Buffer.concat([prefix, new Buffer('ff', 'hex')]);
18+
19+
//var startBuffer = Buffer.concat([prefix, addressLength, new Buffer(address, 'utf8'), new Buffer('00', 'hex')]);
20+
//var endBuffer = Buffer.concat([prefix, addressLength, new Buffer(address, 'utf8'), new Buffer('01', 'hex')]);
21+
var start = Buffer.concat([prefix, new Buffer('0437cd7f8525ceed2324359c2d0ba26006d92d856a9c20fa0241106ee5a597c9', 'hex')]);
22+
var end = Buffer.concat([prefix, new Buffer('0437cd7f8525ceed2324359c2d0ba26006d92d856a9c20fa0241106ee5a597c9', 'hex'), new Buffer('01', 'hex')]);
23+
var stream = db.createReadStream({
24+
gte: start,
25+
lt: end
26+
});
27+
stream.on('data', function(data) {
28+
var txkey = data.key.slice(2).toString('hex');
29+
var height = data.value.readUInt32BE();
30+
var timestamp = data.value.readDoubleBE(4);
31+
var inputValues = [];
32+
var inputValuesLength = data.value.readUInt16BE(12);
33+
for(var i = 0; i < inputValuesLength / 8; i++) {
34+
inputValues.push(buffer.readDoubleBE(i * 8 + 14));
35+
}
36+
var transaction = new bitcore.Transaction(data.value.slice(inputValues.length * 8 + 14));
37+
transaction.__height = height;
38+
transaction.__inputValues = inputValues;
39+
transaction.__timestamp = timestamp;
40+
//console.log(txkey, transaction.toObject());
41+
console.log(data.value);
42+
console.log(transaction.__height, transaction.__inputValues, transaction.__timestamp);
43+
//console.log(data.key.toString('hex'), data.value.toString('hex'));
44+
});
45+
46+
stream.on('end', function() {
47+
console.log('end');
48+
});

contrib/restart_bitcore_node.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
# helper script to run bwdb and/or restart it
4+
5+
# execute thie script and then simply tail /tmp/bwdb-out
6+
# e.g. ./contrib/restart_bwdb.sh && tail -f /tmp/bwdb-out
7+
8+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
9+
pkill -2 -x bitcore
10+
wait
11+
exec $DIR/../bin/bitcore-node start >> /tmp/bwdb-out 2>&1 &

0 commit comments

Comments
 (0)