refactor example.
This commit is contained in:
parent
1c69a1392f
commit
9681c58fc0
|
@ -212,22 +212,26 @@ bitcoind.on('open', function(status) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test fromHex:
|
// Test fromHex:
|
||||||
var block = bitcoind.block.fromHex(testBlock);
|
if (argv['from-hex']) {
|
||||||
assert.equal(block.hash, '0000000000013b8ab2cd513b0261a14096412195a72a0c4827d229dcc7e0f7af');
|
var block = bitcoind.block.fromHex(testBlock);
|
||||||
assert.equal(block.merkleroot, '2fda58e5959b0ee53c5253da9b9f3c0c739422ae04946966991cf55895287552');
|
assert.equal(block.hash, '0000000000013b8ab2cd513b0261a14096412195a72a0c4827d229dcc7e0f7af');
|
||||||
bitcoind.log('Block:');
|
assert.equal(block.merkleroot, '2fda58e5959b0ee53c5253da9b9f3c0c739422ae04946966991cf55895287552');
|
||||||
bitcoind.log(block);
|
bitcoind.log('Block:');
|
||||||
var tx = bitcoind.tx.fromHex(testTx);
|
bitcoind.log(block);
|
||||||
assert.equal(tx.txid, 'b4749f017444b051c44dfd2720e88f314ff94f3dd6d56d40ef65854fcd7fff6b');
|
var tx = bitcoind.tx.fromHex(testTx);
|
||||||
bitcoind.log('Transaction:');
|
assert.equal(tx.txid, 'b4749f017444b051c44dfd2720e88f314ff94f3dd6d56d40ef65854fcd7fff6b');
|
||||||
bitcoind.log(tx);
|
bitcoind.log('Transaction:');
|
||||||
return;
|
bitcoind.log(tx);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Test all parsed packets:
|
// Test all parsed packets:
|
||||||
bitcoind.on('parsed', function(packet) {
|
if (argv['packets']) {
|
||||||
return bitcoind.log(packet);
|
bitcoind.on('parsed', function(packet) {
|
||||||
});
|
return bitcoind.log(packet);
|
||||||
return;
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
argv['on-block'] = true;
|
argv['on-block'] = true;
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
|
|
Loading…
Reference in New Issue