diba-io / bitmask-core

Core functionality for the BitMask wallet
https://bitmask.app
Other
95 stars 23 forks source link

Fix #424 by iterating original_input on match #428

Closed DanGould closed 10 months ago

DanGould commented 10 months ago

The payjoin psbt construction code reintroduces original psbt inputs that the receiver may have lost. It does this by iterating through each proposed input and original input.

This fix only iterates to the next original_input once a proposed input that matches is found, otherwise inputs could be skipped and signing could fail. The outer loop already iterates through proposed inputs. Inputs in the proposal are in the same order as the original as per spec, and just insert receiver inputs so this iteration will always find matches.