Skip to content

Commit

Permalink
Merge branch 'blocks'
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Kleeschulte committed Aug 18, 2017
2 parents 97683d2 + a14de13 commit b89864d
Show file tree
Hide file tree
Showing 98 changed files with 10,951 additions and 12,638 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,7 @@ bin/SHA256SUMS.asc
regtest/data/node1/regtest
regtest/data/node2/regtest
regtest/data/node3/regtest
bitcore-node.json*
*.bak
*.orig
lib/services/insight-api
10 changes: 5 additions & 5 deletions .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
"trailing": true,
"undef": true,
"unused": true,
"maxparams": 4,
"maxstatements": 15,
"maxparams": 6,
"maxstatements": 25,
"maxcomplexity": 10,
"maxdepth": 3,
"maxlen": 120,
"maxdepth": 4,
"maxlen": 140,
"multistr": true,
"predef": [
"after",
Expand All @@ -39,4 +39,4 @@
"module",
"require"
]
}
}
20 changes: 4 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,10 @@
dist: trusty
sudo: false
language: node_js
env:
- CXX=g++-4.8 CC=gcc-4.8
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
- gcc-4.8
- libzmq3-dev
node_js:
- "v0.10.25"
- "v0.12.7"
- "v4"
- 8
script:
- npm run regtest
- npm run test
- npm run coverage
- npm run jshint
after_success:
- npm run coveralls
- npm run coveralls
1 change: 0 additions & 1 deletion benchmarks/data/block-367238.json

This file was deleted.

1 change: 0 additions & 1 deletion benchmarks/data/block-367239.json

This file was deleted.

1 change: 0 additions & 1 deletion benchmarks/data/block-367240.json

This file was deleted.

169 changes: 0 additions & 169 deletions benchmarks/index.js

This file was deleted.

22 changes: 22 additions & 0 deletions bitcore-node.json.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"network": "livenet",
"port": 3001,
"datadir": "/tmp",
"services": [
"p2p",
"db",
"header",
"block",
"transaction",
"timestamp",
"mempool",
"address"
],
"servicesConfig": {
"p2p": {
"peers": [
{ "ip": { "v4": "<some trusted full node>" } }
]
}
}
}
48 changes: 48 additions & 0 deletions contrib/printKeys.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
'use strict';

var levelup = require('levelup');
var leveldown = require('leveldown');
var Encoding = require('../lib/services/address/encoding');
var dbPath = '/Users/chrisk/.bwdb/bitcore-node.db';
var bitcore = require('bitcore-lib');
var db = levelup(dbPath, {keyEncoding: 'binary', valueEncoding: 'binary'});

var prefix = new Buffer('0002', 'hex');
var encoding = new Encoding(prefix);
var address = '1MfDRRVVKXUe5KNVZzu8CBzUZDHTTYZM94';
var addressLength = new Buffer(1);
addressLength.writeUInt8(address.length);

//var startBuffer = prefix;
//var endBuffer = Buffer.concat([prefix, new Buffer('ff', 'hex')]);

//var startBuffer = Buffer.concat([prefix, addressLength, new Buffer(address, 'utf8'), new Buffer('00', 'hex')]);
//var endBuffer = Buffer.concat([prefix, addressLength, new Buffer(address, 'utf8'), new Buffer('01', 'hex')]);
var start = Buffer.concat([prefix, new Buffer('0437cd7f8525ceed2324359c2d0ba26006d92d856a9c20fa0241106ee5a597c9', 'hex')]);
var end = Buffer.concat([prefix, new Buffer('0437cd7f8525ceed2324359c2d0ba26006d92d856a9c20fa0241106ee5a597c9', 'hex'), new Buffer('01', 'hex')]);
var stream = db.createReadStream({
gte: start,
lt: end
});
stream.on('data', function(data) {
var txkey = data.key.slice(2).toString('hex');
var height = data.value.readUInt32BE();
var timestamp = data.value.readDoubleBE(4);
var inputValues = [];
var inputValuesLength = data.value.readUInt16BE(12);
for(var i = 0; i < inputValuesLength / 8; i++) {
inputValues.push(buffer.readDoubleBE(i * 8 + 14));
}
var transaction = new bitcore.Transaction(data.value.slice(inputValues.length * 8 + 14));
transaction.__height = height;
transaction.__inputValues = inputValues;
transaction.__timestamp = timestamp;
//console.log(txkey, transaction.toObject());
console.log(data.value);
console.log(transaction.__height, transaction.__inputValues, transaction.__timestamp);
//console.log(data.key.toString('hex'), data.value.toString('hex'));
});

stream.on('end', function() {
console.log('end');
});
11 changes: 11 additions & 0 deletions contrib/restart_bitcore_node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# helper script to run bwdb and/or restart it

# execute thie script and then simply tail /tmp/bwdb-out
# e.g. ./contrib/restart_bwdb.sh && tail -f /tmp/bwdb-out

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
pkill -2 -x bitcore
wait
exec $DIR/../bin/bitcore-node start >> /tmp/bwdb-out 2>&1 &
Loading

0 comments on commit b89864d

Please sign in to comment.