-
Notifications
You must be signed in to change notification settings - Fork 904
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
Add RPCs to bookkeeper so you can update/set a description on an event #7604
Add RPCs to bookkeeper so you can update/set a description on an event #7604
Conversation
lowest = fee->timestamp; | ||
db_begin_transaction(db); | ||
edit_utxo_description(db, outpoint, new_desc); | ||
chain_events = get_chain_events_by_outpoint(cmd, db, outpoint, true); |
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.
Is returning the events with updated descriptions meant as confirmation that the command was successful and rows were updated? How about failing the command with an error (eg no events found for description
) if no rows were updated? Would make it a lot easier to handle error states when using the command via RPC or gRPC. If there is a need to show the results, querying events for an id is easy enough with #7536
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.
Yes, returning the results is a convenience in case you need/want to display the result to a user in an interface. It also allows for the caller to locally update their stored set of events instead of re-querying.
I go back on forth on whether or not to error on "there's nothing to update that matches that description". Returning an empty result set seems like a fine way of signaling that no results were found -- nothing got updated? Really a matter of taste, and I just so happen to dislike "noisy errors" -> nothing wrong happened during execution it just so happens that the input you put in had no effect.
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.
I just so happen to dislike "noisy errors" -> nothing wrong happened during execution it just so happens that the input you put in caused no effect
The explicit intention of the command is that something happens so imho nothing happening is an error. But returning an empty result is probably more in line with other CLN commands. As a caller you just have to be careful to check for the length of returned results > 0 and handle that accordingly.
bad0b8c
to
cf26e66
Compare
"resources": [ | ||
"Main web site: <https://github.com/ElementsProject/lightning>" | ||
], | ||
"examples": [ |
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.
did we want examples autogenerated for these?
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.
Yes! Do you know how to do that?
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.
Been trying since yesterday but it keeps erroring out, ill keep trying i need to debug more closely
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.
very close now
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.
added in niftynei#9
plugins/bkpr/bookkeeper.c
Outdated
&& (lowest == 0 || lowest > chan->timestamp)) | ||
lowest = chan->timestamp; | ||
if (!param(cmd, buf, params, | ||
p_req("identifier", param_outpoint, &outpoint), |
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.
needs to be 'outpoint' to match the schema or it cant find the param, ill update in my commit soon to come
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.
resolved in niftynei#9
ef8b66d
to
6ad7666
Compare
This takes an {payment_id} and {description}. It looks for all chain + channel events that match that {payment_id} and updates the description for those events. We return all the updated events. If no events are updated, an empty list is returned. Changelog-Added: PLUGINS: bookkeeper has a new RPC `bkpr-editdescriptionbypaymentid` which will update the description for any event with matching payment_id
Given an {outpoint}, sets the description on the matching outpoint (if exists). Note that if no outpoint exists in bookkeeper, will return an empty list Changleog-Added: PLUGINS: bookkeeper has a new RPC `bkrp-editdescriptionbyoutpoint` which will set/update a description for an outpoint creation event.
Lets make sure that edit description works as intended.
6ad7666
to
d31e6c6
Compare
Make it such that you can update/set the description on bookkeeper events after they've been created.
Adds two new RPC commands to the bookkeeping plugin
bkpr-editdescriptionbypaymentid
andbkpr-editdescriptionbyoutpoint
These will update/set the description for any/all events that match the payment_id or outpoint, respectively. Returns the list of updated events, or an empty list if no events matched/were updated.
Note that for outpoints, only the deposit/creation event is updated with the description. "input" side events are left un-descripted.