blockdb, segwit, and input fixes.
This commit is contained in:
parent
4c653683b7
commit
5d1f6089ed
@ -520,7 +520,7 @@ BlockDB.prototype.getCoinsByAddress = function getCoinsByAddress(addresses, opti
|
||||
});
|
||||
}
|
||||
|
||||
if (!key) {
|
||||
if (key === undefined) {
|
||||
return iter.end(function(err) {
|
||||
if (err)
|
||||
return done(err);
|
||||
@ -543,7 +543,7 @@ BlockDB.prototype.getCoinsByAddress = function getCoinsByAddress(addresses, opti
|
||||
}
|
||||
|
||||
if (!data)
|
||||
return done();
|
||||
return next();
|
||||
|
||||
try {
|
||||
data = bcoin.protocol.parser.parseOutput(data);
|
||||
@ -658,7 +658,7 @@ BlockDB.prototype.getTXByAddress = function getTXByAddress(addresses, options, c
|
||||
});
|
||||
}
|
||||
|
||||
if (!key) {
|
||||
if (key === undefined) {
|
||||
return iter.end(function(err) {
|
||||
if (err)
|
||||
return done(err);
|
||||
@ -812,7 +812,7 @@ BlockDB.prototype.getBlock = function getBlock(hash, callback) {
|
||||
if (data) {
|
||||
try {
|
||||
block = bcoin.protocol.parser.parseBlock(data);
|
||||
block = new bcoin.block(block, 'block');
|
||||
block = new bcoin.block(block);
|
||||
} catch (e) {
|
||||
return callback(e);
|
||||
}
|
||||
@ -977,7 +977,7 @@ BlockDB.prototype.getHeight = function getHeight(callback) {
|
||||
});
|
||||
}
|
||||
|
||||
if (!key) {
|
||||
if (key === undefined) {
|
||||
return iter.end(function(err) {
|
||||
if (err)
|
||||
return callback(err);
|
||||
|
||||
@ -60,7 +60,7 @@ Input.prototype.getType = function getType() {
|
||||
if (this.witness.length > 0)
|
||||
type = bcoin.script.getInputType(this.witness, null, true);
|
||||
|
||||
if (type === 'unknown')
|
||||
if (!type || type === 'unknown')
|
||||
type = bcoin.script.getInputType(this.script);
|
||||
|
||||
if (!this._mutable)
|
||||
|
||||
@ -316,6 +316,7 @@ script.verify = function verify(input, witness, output, tx, i, flags) {
|
||||
if ((flags & constants.flags.VERIFY_WITNESS) && script.isWitnessProgram(output)) {
|
||||
if (!script.verifyProgram(input, witness, output, tx, i, flags))
|
||||
return false;
|
||||
// TODO: FIX STACK HERE
|
||||
}
|
||||
|
||||
// If the script is P2SH, execute the real output script
|
||||
@ -433,7 +434,7 @@ script.verifyProgram = function verifyProgram(input, witness, output, tx, i, fla
|
||||
return false;
|
||||
}
|
||||
|
||||
res = script.execute(output, stack, tx, i, flags);
|
||||
res = script.execute(script, stack, tx, i, flags);
|
||||
|
||||
// Verify the script did not fail as well as the stack values
|
||||
if (!res || stack.length === 0 || !script.bool(stack.pop()))
|
||||
@ -1328,7 +1329,7 @@ script.checkPush = function checkPush(op, value, flags) {
|
||||
if (value.length === 1 && value[0] >= 1 && value[0] <= 16)
|
||||
return +op >= 1 && +op <= 16;
|
||||
|
||||
if (value.length === 1 && value[0] === -1)
|
||||
if (value.length === 1 && value[0] === 0xff)
|
||||
return op === '1negate';
|
||||
|
||||
if (value.length <= 75)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user