stakwork / sphinx-key

Lightning hardware signer on ESP32
29 stars 1 forks source link

Implement ReceiveOnly and ReceiveSend signer types #106

Open irriden opened 1 year ago

irriden commented 1 year ago

This passes the following test:

Two signers connected to broker. One is ReceiveSend, the other is ReceiveOnly.

First send some keysends to the node, with ReceiveOnly settling them.

Then send a keysend to the other way, from the node to a peer.

Broker immediately switches to the ReceiveSend signer, syncs the state, and sends the keysend.

It's all about watching for PreapproveKeysend and PreapproveInvoice messages, and switching to the appropriate ReceiveSend signer when these come through.

Watching for on-chain sends still todo.

irriden commented 1 year ago

Should address #105

irriden commented 1 year ago

I think I've addressed point 2 here: 9f5be6f

Now wondering if instead of ReceiveOnly and ReceiveSend we should have three independent bit flags so to speak - Signer, Receive, Send.

ReceiveOnly would have Signer and Receive set. ReceiveSend would have Signer, Send, and Receive set. And if you wanted a message to be signed by any signer, you would only set Signer.

irriden commented 1 year ago

This could help get rid of these weird cases where the signer type is set to None maybe? Haven't looked closely.

Evanfeenstra commented 1 year ago

To be honest i think ReceiveOnly and ReceiveSend is simpler to understand