bitcoinjs / bitcoinjs-lib

A javascript Bitcoin library for node.js and browsers.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SIGHASH_SINGLE | ANYONECANPAY input signed but can't update the unsigned inputs

elRaulito opened this issue · comments

commented

I created a psbts with the following inputs:

0 Coming from segwit timelock multisig script, signature SIGHASH_SINGLE | ANYONECANPAY
1 Placeholder that will be filled later

I sign 0 and works fine, however as soon as I try to update input 1 as follows

    psbtPartial.updateInput(1,{
      hash: "34466a1f38495b4bc7db5aa07168dddf2c304f535a604a3104a0b610b2b91fc9",
      index: parseInt(0),
      witnessUtxo: {
        script: p2sh.output,
        value: parseInt(30000),
      },
      redeemScript: p2shBorrower.redeem.output
  });

I get the error:

image

Are you sure you don't mean to addInput?

@elRaulito
It's obvious that input1 doesn't exist, you should use addInput to add it

If you have no further questions I will close this PR