fix regressions
This commit is contained in:
parent
fdb4051e87
commit
62948352d9
@ -67,7 +67,6 @@ describe('NetworkMonitor', function() {
|
|||||||
it('broadcasts errors in underlying peer', function(cb) {
|
it('broadcasts errors in underlying peer', function(cb) {
|
||||||
var nm = new NetworkMonitor(busMock, peerMock);
|
var nm = new NetworkMonitor(busMock, peerMock);
|
||||||
nm.on('error', function() {
|
nm.on('error', function() {
|
||||||
console.log('under');
|
|
||||||
cb();
|
cb();
|
||||||
});
|
});
|
||||||
nm.start();
|
nm.start();
|
||||||
|
|||||||
@ -80,7 +80,7 @@ describe('BlockService', function() {
|
|||||||
|
|
||||||
describe('block confirmation', function() {
|
describe('block confirmation', function() {
|
||||||
|
|
||||||
var mockRpc, transactionMock, database, blockService, writeLock;
|
var mockRpc, transactionMock, database, blockService;
|
||||||
|
|
||||||
var thenCaller = {
|
var thenCaller = {
|
||||||
then: function(arg) {
|
then: function(arg) {
|
||||||
@ -118,7 +118,7 @@ describe('BlockService', function() {
|
|||||||
var expectedOps = [{
|
var expectedOps = [{
|
||||||
type: 'put',
|
type: 'put',
|
||||||
key: 'header-000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f',
|
key: 'header-000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f',
|
||||||
value: '{"version":1,"prevHash":"0000000000000000000000000000000000000000000000000000000000000000","merkleRoot":"3ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a","time":1231006505,"bits":486604799,"nonce":2083236893}'
|
value: '{"version":1,"prevHash":"0000000000000000000000000000000000000000000000000000000000000000","merkleRoot":"4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b","time":1231006505,"bits":486604799,"nonce":2083236893}'
|
||||||
}, {
|
}, {
|
||||||
type: 'put',
|
type: 'put',
|
||||||
key: 'nxt-0000000000000000000000000000000000000000000000000000000000000000',
|
key: 'nxt-0000000000000000000000000000000000000000000000000000000000000000',
|
||||||
@ -149,10 +149,10 @@ describe('BlockService', function() {
|
|||||||
|
|
||||||
it('makes the expected calls when confirming the block #170', function(callback) {
|
it('makes the expected calls when confirming the block #170', function(callback) {
|
||||||
database.batchAsync = function(ops) {
|
database.batchAsync = function(ops) {
|
||||||
ops.should.deep.equal([{
|
var eops = [{
|
||||||
type: 'put',
|
type: 'put',
|
||||||
key: 'header-00000000d1145790a8694403d4063f323d499e655c83426834d4ce2f8dd4a2ee',
|
key: 'header-00000000d1145790a8694403d4063f323d499e655c83426834d4ce2f8dd4a2ee',
|
||||||
value: '{"version":1,"prevHash":"55bd840a78798ad0da853f68974f3d183e2bd1db6a842c1feecf222a00000000","merkleRoot":"ff104ccb05421ab93e63f8c3ce5c2c2e9dbb37de2764b3a3175c8166562cac7d","time":1231731025,"bits":486604799,"nonce":1889418792}'
|
value: '{"version":1,"prevHash":"000000002a22cfee1f2c846adbd12b3e183d4f97683f85dad08a79780a84bd55","merkleRoot":"7dac2c5666815c17a3b36427de37bb9d2e2c5ccec3f8633eb91a4205cb4c10ff","time":1231731025,"bits":486604799,"nonce":1889418792}'
|
||||||
}, {
|
}, {
|
||||||
type: 'put',
|
type: 'put',
|
||||||
key: 'nxt-000000002a22cfee1f2c846adbd12b3e183d4f97683f85dad08a79780a84bd55',
|
key: 'nxt-000000002a22cfee1f2c846adbd12b3e183d4f97683f85dad08a79780a84bd55',
|
||||||
@ -173,7 +173,8 @@ describe('BlockService', function() {
|
|||||||
type: 'put',
|
type: 'put',
|
||||||
key: 'tip',
|
key: 'tip',
|
||||||
value: block170.id
|
value: block170.id
|
||||||
}]);
|
}];
|
||||||
|
ops.should.deep.equal(eops);
|
||||||
return callback();
|
return callback();
|
||||||
};
|
};
|
||||||
blockService.writeLock.onFirstCall().returns(thenCaller);
|
blockService.writeLock.onFirstCall().returns(thenCaller);
|
||||||
|
|||||||
@ -107,40 +107,23 @@ describe('TransactionService', function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
service._confirmTransaction(ops, block170, block170.transactions[1]).then(function() {
|
service._confirmTransaction(ops, block170, block170.transactions[1]).then(function() {
|
||||||
ops.map(function(k) {
|
ops.should.deep.equal([{
|
||||||
if (bitcore.util.js.isValidJSON(k.value)) {
|
|
||||||
k.value = JSON.parse(k.value);
|
|
||||||
}
|
|
||||||
return k;
|
|
||||||
}).should.deep.equal([{
|
|
||||||
type: 'put',
|
type: 'put',
|
||||||
key: 'btx-f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16',
|
key: 'btx-f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16',
|
||||||
value: '00000000d1145790a8694403d4063f323d499e655c83426834d4ce2f8dd4a2ee'
|
value: '00000000d1145790a8694403d4063f323d499e655c83426834d4ce2f8dd4a2ee'
|
||||||
}, {
|
}, {
|
||||||
type: 'put',
|
type: 'put',
|
||||||
key: 'txo-f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16-0',
|
key: 'txo-f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16-0',
|
||||||
value: {
|
value: '{"satoshis":1000000000,"script":"65 0x04ae1a62fe09c5f51b13905f07f06b99a2f7159b2225f374cd378d71302fa28414e7aab37397f554a7df5f142c21c1b7303b8a0626f1baded5c72a704f7e6cd84c OP_CHECKSIG"}'
|
||||||
satoshis: 1000000000,
|
|
||||||
script: '65 0x04ae1a62fe09c5f51b13905f07f06b99a2f7159b2225f374cd378d71302fa28414e7aab37397f554a7df5f142c21c1b7303b8a0626f1baded5c72a704f7e6cd84c OP_CHECKSIG'
|
|
||||||
}
|
|
||||||
}, {
|
}, {
|
||||||
type: 'put',
|
type: 'put',
|
||||||
key: 'txo-f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16-1',
|
key: 'txo-f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16-1',
|
||||||
value: {
|
value: '{"satoshis":4000000000,"script":"65 0x0411db93e1dcdb8a016b49840f8c53bc1eb68a382e97b1482ecad7b148a6909a5cb2e0eaddfb84ccf9744464f82e160bfa9b8b64f9d4c03f999b8643f656b412a3 OP_CHECKSIG"}'
|
||||||
satoshis: 4000000000,
|
|
||||||
script: '65 0x0411db93e1dcdb8a016b49840f8c53bc1eb68a382e97b1482ecad7b148a6909a5cb2e0eaddfb84ccf9744464f82e160bfa9b8b64f9d4c03f999b8643f656b412a3 OP_CHECKSIG'
|
|
||||||
}
|
|
||||||
}, {
|
}, {
|
||||||
type: 'put',
|
type: 'put',
|
||||||
key: 'txo-f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16-0',
|
key: 'txo-f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16-0',
|
||||||
value: {
|
value: '{"prevTxId":"0437cd7f8525ceed2324359c2d0ba26006d92d856a9c20fa0241106ee5a597c9","outputIndex":0,"sequenceNumber":4294967295,"script":"47304402204e45e16932b8af514961a1d3a1a25fdf3f4f7732e9d624c6c61548ab5fb8cd410220181522ec8eca07de4860a4acdd12909d831cc56cbbac4622082221a8768d1d0901","scriptString":"71 0x304402204e45e16932b8af514961a1d3a1a25fdf3f4f7732e9d624c6c61548ab5fb8cd410220181522ec8eca07de4860a4acdd12909d831cc56cbbac4622082221a8768d1d0901","heightConfirmed":170}'
|
||||||
prevTxId: '0437cd7f8525ceed2324359c2d0ba26006d92d856a9c20fa0241106ee5a597c9',
|
}]);
|
||||||
outputIndex: 0,
|
|
||||||
sequenceNumber: 4294967295,
|
|
||||||
script: '71 0x304402204e45e16932b8af514961a1d3a1a25fdf3f4f7732e9d624c6c61548ab5fb8cd410220181522ec8eca07de4860a4acdd12909d831cc56cbbac4622082221a8768d1d0901',
|
|
||||||
heightConfirmed: 170
|
|
||||||
}
|
|
||||||
}, ]);
|
|
||||||
/* TODO: This should work if address spent is accepted for public key. Add test for P2PKH if not accepted
|
/* TODO: This should work if address spent is accepted for public key. Add test for P2PKH if not accepted
|
||||||
* { type: 'put',
|
* { type: 'put',
|
||||||
key: 'txas-12cbQLTFMXRnSzktFkuoG3eHoMeFtpTu3S-f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16-0',
|
key: 'txas-12cbQLTFMXRnSzktFkuoG3eHoMeFtpTu3S-f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16-0',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user