add simpler test that fails

This commit is contained in:
Manuel Araoz 2015-04-29 15:54:41 -03:00
parent 722eddb894
commit 270413a655
4 changed files with 15 additions and 3 deletions

View File

@ -68,8 +68,9 @@ Block._fromJSON = function _fromJSON(data) {
*/
Block._fromObject = function _fromObject(data) {
var transactions = [];
data.transactions.forEach(function(data) {
transactions.push(Transaction().fromJSON(data));
data.transactions.forEach(function(tx) {
console.log(tx.id);
transactions.push(Transaction().fromJSON(tx));
});
var info = {
header: BlockHeader.fromObject(data.header),

View File

@ -158,6 +158,7 @@ Script.fromString = function(str) {
});
i = i + 2;
} else {
console.log(token, opcodenum, i);
throw new Error('Invalid script: ' + JSON.stringify(str));
}
} else if (opcodenum === Opcode.OP_PUSHDATA1 ||

View File

@ -120,7 +120,7 @@ describe('Block', function() {
});
describe.only('#fromBuffer', function() {
describe('#fromBuffer', function() {
it('should make a block from this known buffer', function() {
var block = Block.fromBuffer(blockbuf);

View File

@ -754,5 +754,15 @@ describe('Script', function() {
Script().add(new Buffer('a')).equals(Script().add(new Buffer('b'))).should.equal(false);
});
});
describe.only('coinbase transaction input script', function() {
it('works for bug found in bitcore-node', function() {
var hex = '03984b05e4b883e5bda9e7a59ee4bb99e9b1bcfabe6d6d5cb348c1c7d580627835202f5ad93c2f3db10bb850a1a513979f8328d9f35aff1000000000000000006189dd01cf00004d696e6564206279207975313333353131373131';
var s = new Script(hex);
var s2 = new Script(s.toString());
console.log(s2.toString());
s2.toString().should.equal(s.toString());
});
});
});