Merge branch 'master' into trimSpace

This commit is contained in:
junderw 2019-05-21 15:42:43 +09:00
commit 9aa2842123
No known key found for this signature in database
GPG key ID: B256185D3A971908
10 changed files with 1181 additions and 1154 deletions

View file

@ -29,6 +29,7 @@ class TransactionBuilder {
this.__INPUTS = [];
this.__TX = new transaction_1.Transaction();
this.__TX.version = 2;
this.__USE_LOW_R = false;
}
static fromTransaction(transaction, network) {
const txb = new TransactionBuilder(network);
@ -53,6 +54,14 @@ class TransactionBuilder {
});
return txb;
}
setLowR(setting) {
typeforce(typeforce.maybe(typeforce.Boolean), setting);
if (setting === undefined) {
setting = true;
}
this.__USE_LOW_R = setting;
return setting;
}
setLockTime(locktime) {
typeforce(types.UInt32, locktime);
// if any signatures exist, throw
@ -172,7 +181,7 @@ class TransactionBuilder {
'BIP143 rejects uncompressed public keys in P2WPKH or P2WSH',
);
}
const signature = keyPair.sign(signatureHash);
const signature = keyPair.sign(signatureHash, this.__USE_LOW_R);
input.signatures[i] = bscript.signature.encode(signature, hashType);
return true;
});