-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement ReceiveOnly and ReceiveSend signer types #106
base: master
Are you sure you want to change the base?
Conversation
Should address #105 |
reads the first byte of the hello message payload to determine the type. if the payload is empty, the signer type is receivesend, otherwise, whatever the byte specifies. signer types are then stored as values in the conns hash table whenever a signer is added to it.
make it optional just like the cid field.
Everytime CLN wants to pay an invoice, or send a keysend, the very first message it sends is either PreapproveInvoice, or PreapproveKeysend. So these should go only to signers that have the send feature. If for some reason the send signer crashes, and broker starts talking to a receiveonly signer, 1) broker will see that it's receive only, so it will wait for a send signer to connect back. 2) if broker still sends, the receive only signer can be programmed to immediately reject any preapprove messages.
c755601
to
d792db8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
in broker/src/main, you removed theclient_action
, which can set the connected status to true or false. Instead you addedadd_client
. So there is no way for a signer to disconnect anymore (by publishing BYE) -
why does connections.
current
need (String, SignerType)? Since we have the SignerType in theclient
map anyway.. seems like its stored in two places?
I think I've addressed point 2 here: 9f5be6f Now wondering if instead of
|
This could help get rid of these weird cases where the signer type is set to None maybe? Haven't looked closely. |
To be honest i think ReceiveOnly and ReceiveSend is simpler to understand |
This passes the following test:
Two signers connected to broker. One is
ReceiveSend
, the other isReceiveOnly
.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
andPreapproveInvoice
messages, and switching to the appropriateReceiveSend
signer when these come through.Watching for on-chain sends still todo.