Avoiding footguns in receiver state machine #670
spacebear21
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I've been working on the Boltz Payjoin integration and almost made a mistake that I think we can do better to help prevent.
While the receiver state machine ensures that all receiver checks are performed in the right order, it leaves the correctness of those checks in the hands of the application developer. In my case, I was working on implementing
identify_receiver_outputsand basically copied the payjoin-cli reference approach of using bitcoin-cli'sgetaddressinfoto check if an output is mine. However:This is the OutputsUnknown interface that identifies which outputs belong to the receiver:
Any identified output is then considered fair game by the receiver state machine to substitute, and all additional input value added by the receiver is added to the change output as identified by this method. Thus it is critical for implementers to get this right.
We can certainly do better with the docstring. @nothingmuch also suggested renaming some functions, and the persistence event log as a way to at least monitor/alert implementation errors.
All reactions