refactor.
This commit is contained in:
parent
513fe6b196
commit
c91cf7571b
@ -96,11 +96,8 @@ function LowlevelUp(file, options) {
|
||||
|
||||
// Stay as close to the metal as possible.
|
||||
// We want to make calls to C++ directly.
|
||||
if (this.db.db && this.db.db.put) {
|
||||
while (this.db.db && this.db.db.put)
|
||||
this.db = this.db.db;
|
||||
if (this.db.db && this.db.db.put)
|
||||
this.db = this.db.db;
|
||||
}
|
||||
|
||||
this.binding = this.db;
|
||||
this.hasBinding = false;
|
||||
|
||||
@ -1810,7 +1810,7 @@ Script.isMultisigInput = function isMultisigInput(code, keys, isWitness) {
|
||||
// it may look like multisig. This is
|
||||
// strange because it's technically a
|
||||
// recursive call.
|
||||
if (Script.isScripthashInput(null, isWitness))
|
||||
if (Script.isScripthashInput(code, null, isWitness))
|
||||
return false;
|
||||
|
||||
if (code.length < 3)
|
||||
@ -1895,11 +1895,10 @@ Script.prototype.getCoinbaseData = function getCoinbaseData() {
|
||||
script: this
|
||||
};
|
||||
|
||||
if (Buffer.isBuffer(this.code[0]) && this.code[0].length <= 6) {
|
||||
if (Buffer.isBuffer(this.code[0]) && this.code[0].length <= 6)
|
||||
coinbase.height = new bn(this.code[0], 'le').toNumber();
|
||||
} else {
|
||||
else
|
||||
coinbase.height = -1;
|
||||
}
|
||||
|
||||
if (Buffer.isBuffer(this.code[1]))
|
||||
coinbase.extraNonce = new bn(this.code[1], 'le');
|
||||
@ -1911,11 +1910,12 @@ Script.prototype.getCoinbaseData = function getCoinbaseData() {
|
||||
});
|
||||
|
||||
coinbase.flags = flags;
|
||||
coinbase.text =
|
||||
flags.map(function(flag) {
|
||||
return flag.toString('utf8');
|
||||
}).join('')
|
||||
.replace(/[\u0000-\u0019\u007f-\u00ff]/g, '');
|
||||
|
||||
flags = flags.map(function(flag) {
|
||||
return flag.toString('utf8');
|
||||
});
|
||||
|
||||
coinbase.text = flags.join('').replace(/[\u0000-\u0019\u007f-\u00ff]/g, '');
|
||||
|
||||
return coinbase;
|
||||
};
|
||||
@ -2214,9 +2214,9 @@ Script.prototype.isPushOnly = function isPushOnly() {
|
||||
};
|
||||
|
||||
Script.prototype.getSigops = function getSigops(accurate) {
|
||||
var i, op;
|
||||
var total = 0;
|
||||
var lastOp = -1;
|
||||
var i, op;
|
||||
|
||||
for (i = 0; i < this.code.length; i++) {
|
||||
op = this.code[i];
|
||||
|
||||
@ -773,7 +773,7 @@ utils.array2ip = function array2ip(ip, version) {
|
||||
ip = utils.ip2version(ip, version);
|
||||
|
||||
if (version === 4)
|
||||
return Array.prototype.slice.call(ip).join('.');
|
||||
return ip[0] + '.' + ip[1] + '.' + ip[2] + '.' + ip[3];
|
||||
|
||||
if (version === 6) {
|
||||
out = [];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user