psbt: don't remove non-witness UTXO for segwit v0
As a countermeasure to CVE-2020-14199 new HW wallet firmwares require the full non-witness UTXO to be set even for witness inputs. We therefore shouldn't remove it when signing.
This commit is contained in:
parent
c5f199e40f
commit
b283b0eb92
1 changed files with 5 additions and 2 deletions
|
@ -142,8 +142,11 @@ func nonWitnessToWitness(p *Packet, inIndex int) error {
|
||||||
outIndex := p.UnsignedTx.TxIn[inIndex].PreviousOutPoint.Index
|
outIndex := p.UnsignedTx.TxIn[inIndex].PreviousOutPoint.Index
|
||||||
txout := p.Inputs[inIndex].NonWitnessUtxo.TxOut[outIndex]
|
txout := p.Inputs[inIndex].NonWitnessUtxo.TxOut[outIndex]
|
||||||
|
|
||||||
// Remove the non-witness first, else sanity check will not pass:
|
// TODO(guggero): For segwit v1, we'll want to remove the NonWitnessUtxo
|
||||||
p.Inputs[inIndex].NonWitnessUtxo = nil
|
// from the packet. For segwit v0 it is unsafe to only rely on the
|
||||||
|
// witness UTXO. See https://github.com/bitcoin/bitcoin/pull/19215.
|
||||||
|
// p.Inputs[inIndex].NonWitnessUtxo = nil
|
||||||
|
|
||||||
u := Updater{
|
u := Updater{
|
||||||
Upsbt: p,
|
Upsbt: p,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue