working again

This commit is contained in:
Thomas Kerin 2016-11-12 17:10:53 +01:00
parent 9d766df519
commit c60a6418b5
3 changed files with 3 additions and 4 deletions

View File

@ -43,4 +43,4 @@ signer.sign(0, root.keyPair, {
value: txOut.value
})
var txd = signer.done()
console.log(txd.toBufferWithWitness().toString('hex'))
console.log(txd.toBuffer().toString('hex'))

View File

@ -29,7 +29,7 @@ builder.addOutput('2N6stcWuMpLgt4nkiaEFXP6p9J9VKRHCwDJ', 10000)
var unsigned = builder.buildIncomplete()
var signer = new TxSigner(unsigned)
signer.sign(0, root.keyPair, {
scriptPubKey: txOut.scriptPubKey,
scriptPubKey: txOut.script,
redeemScript: p2shScript,
witnessScript: witnessScript,
value: txOut.value

View File

@ -355,7 +355,7 @@ InSigner.prototype.sign = function (key, sigHashType) {
if (solution.type === bscript.types.P2SH) {
// solution updated, type is the type of the redeemScript
solution = this.redeemScript
if (bscript.P2SH_SCRIPTS.indexOf(solution.type)) {
if (ALLOWED_P2SH_SCRIPTS.indexOf(solution.type) !== -1) {
if (solution.canSign) {
[this.signatures, this.publicKeys] = signStandard(this.tx, this.nIn, undefined, this.signatures, this.publicKeys, key, solution, sigHashType, Transaction.SIG_V0)
}
@ -484,7 +484,6 @@ TxSigner.prototype.sign = function (nIn, key, opts, sigHashType) {
}
// You can probably make this work with the current library, if you can work out the witnessScript above!
// generate opts for the internal signer based off older way of positional arguments to TxSigner.sign
if (this.states[nIn] === undefined) {
this.states[nIn] = new InSigner(this.tx, nIn, opts)
}