Browse Source

add simpler test that fails

patch-2
Manuel Araoz 10 years ago
parent
commit
270413a655
  1. 5
      lib/block/block.js
  2. 1
      lib/script/script.js
  3. 2
      test/block.js
  4. 10
      test/script/script.js

5
lib/block/block.js

@ -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),

1
lib/script/script.js

@ -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 ||

2
test/block.js

@ -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);

10
test/script/script.js

@ -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());
});
});
});

Loading…
Cancel
Save