better nonstandard signing.
This commit is contained in:
parent
1258cbbbd4
commit
5e00e42903
@ -194,16 +194,16 @@ TX.prototype.scriptInput = function scriptInput(index, pub, redeem) {
|
||||
|
||||
if (bcoin.script.isPubkey(s)) {
|
||||
// P2PK
|
||||
input.script = [ [] ];
|
||||
input.script = [[]];
|
||||
} else if (bcoin.script.isPubkeyhash(s)) {
|
||||
// P2PKH
|
||||
input.script = [ [], pub ];
|
||||
input.script = [[], pub];
|
||||
} else if (bcoin.script.isMultisig(s)) {
|
||||
// Multisig
|
||||
// Technically we should create m signature slots,
|
||||
// but we create n signature slots so we can order
|
||||
// the signatures properly.
|
||||
input.script = [ [] ];
|
||||
input.script = [[]];
|
||||
|
||||
// Grab `n` value (number of keys).
|
||||
n = s[s.length - 2];
|
||||
@ -213,10 +213,17 @@ TX.prototype.scriptInput = function scriptInput(index, pub, redeem) {
|
||||
input.script[i + 1] = [];
|
||||
} else {
|
||||
// Likely a non-standard scripthash multisig
|
||||
// input. Just set up the empty array. Also,
|
||||
// only allow nonstandard types for scripthash.
|
||||
if (redeem)
|
||||
input.script = [ [] ];
|
||||
// input. Determine n value by counting keys.
|
||||
// Also, only allow nonstandard types for
|
||||
// scripthash.
|
||||
if (redeem) {
|
||||
input.script = [[]];
|
||||
// Fill script with `n` signature slots.
|
||||
for (i = 0; i < s.length; i++) {
|
||||
if (bcoin.script.isKey(s[i]))
|
||||
input.script.push([]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// P2SH requires the redeem script after signatures
|
||||
@ -782,7 +789,7 @@ TX.prototype.isCoinbase = function isCoinbase() {
|
||||
|
||||
TX.prototype.maxSize = function maxSize() {
|
||||
var copy = this.clone();
|
||||
var i, input, total, size, s, m, n;
|
||||
var i, j, input, total, size, s, m, n;
|
||||
|
||||
// Create copy with 0-script inputs
|
||||
for (i = 0; i < copy.inputs.length; i++)
|
||||
@ -856,6 +863,12 @@ TX.prototype.maxSize = function maxSize() {
|
||||
size += 1;
|
||||
// OP_CHECKMULTISIG
|
||||
size += 1;
|
||||
} else {
|
||||
// OP_PUSHDATA0 [signature]
|
||||
for (j = 0; j < s.length; j++) {
|
||||
if (bcoin.script.isKey(s[j]))
|
||||
size += 1 + 73;
|
||||
}
|
||||
}
|
||||
|
||||
// Byte for varint size of input script
|
||||
|
||||
Loading…
Reference in New Issue
Block a user