Merge pull request #741 from cfromknecht/utxn-witness-indexes

utxonursery: fix witness overwriting bug on sweep txn
This commit is contained in:
Olaoluwa Osuntokun 2018-02-08 15:25:22 -08:00 committed by GitHub
commit b5bb1e027d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1095,8 +1095,12 @@ func (u *utxoNursery) populateSweepTx(txWeight uint64, classHeight uint32,
return nil, err
}
}
// Add offset to relative indexes so cltv witnesses don't overwrite csv
// witnesses.
offset := len(csvInputs)
for i, input := range cltvInputs {
if err := addWitness(i, input); err != nil {
if err := addWitness(offset+i, input); err != nil {
return nil, err
}
}