handle coinbase tests.
This commit is contained in:
parent
b3c1a2a81b
commit
a871054387
@ -114,13 +114,12 @@ describe('TX', function() {
|
|||||||
tx.fillCoins(coin);
|
tx.fillCoins(coin);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!tx.hasCoins())
|
|
||||||
return;
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
tx: tx,
|
tx: tx,
|
||||||
flags: flags,
|
flags: flags,
|
||||||
comments: tx.inputs[0].coin.script.inspect(),
|
comments: tx.hasCoins()
|
||||||
|
? utils._inspect(tx.inputs[0].coin.script, false).slice(0, -1)
|
||||||
|
: 'coinbase',
|
||||||
data: data
|
data: data
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -147,10 +146,16 @@ describe('TX', function() {
|
|||||||
var flags = data.flags;
|
var flags = data.flags;
|
||||||
var comments = comment.trim();
|
var comments = comment.trim();
|
||||||
if (!comments)
|
if (!comments)
|
||||||
comments = data.comment;
|
comments = data.comments;
|
||||||
comment = '';
|
comment = '';
|
||||||
|
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
if (comments.indexOf('Coinbase') === 0) {
|
||||||
|
it('should handle valid coinbase: ' + comments, function () {
|
||||||
|
assert.ok(tx.isSane());
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
it('should handle valid tx test: ' + comments, function () {
|
it('should handle valid tx test: ' + comments, function () {
|
||||||
assert.ok(tx.verify(null, true, flags));
|
assert.ok(tx.verify(null, true, flags));
|
||||||
});
|
});
|
||||||
@ -161,8 +166,14 @@ describe('TX', function() {
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (comments.indexOf('Coinbase') === 0) {
|
||||||
|
it('should handle invalid coinbase: ' + comments, function () {
|
||||||
|
assert.ok(!tx.isSane());
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
it('should handle invalid tx test: ' + comments, function () {
|
it('should handle invalid tx test: ' + comments, function () {
|
||||||
assert.ok(!tx.verify(null, true, flags));
|
assert.ok(!tx.verify(null, true, flags));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user