-
Notifications
You must be signed in to change notification settings - Fork 912
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
Collaborative transaction building #5287
Conversation
c1e118a
to
465a318
Compare
5ca53bf
to
7a8813f
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.
Bunch of small nits and things, but overall lgtm! Biggest thing is that there's a decent amount of setup needed for the ictx
-- do you have a new_ictx
method somewhere that encapsulates this?
This appears to duplicate a lot of code that, when changed, will cause things to slowly drift apart. Any chance of not just extracting this but also to rewire the existing uses to use |
Yeah definitely. The plan is to make dual open use this code, cutting out its internal implementation, probably next release ish? Also a good moment for some interim tests to look for behavior changes in the refactor. Dual open is currently the only user of interactivetx but splicing and dual close will want to use it. |
Excellent, thanks @ddustin. Want me to wait for |
c435cbc
to
53603a6
Compare
4366fca
to
6f1f6e7
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.
ACK with a few changes! lgtm, let's goo!
common/interactivetx.c
Outdated
ictx->channel_id = channel_id; | ||
ictx->tx_msg_count[TX_ADD_INPUT] = 0; | ||
ictx->tx_msg_count[TX_ADD_OUTPUT] = 0; | ||
ictx->tx_msg_count[TX_RM_INPUT] = 0; |
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 think we can remove the "RM" counts, as the spec only counts adds (for the reason that you'll hit the add limit first!)
struct channel_id channel_id); | ||
|
||
/* Blocks the thread until we run out of changes (and we send tx_complete), | ||
* or an error occurs. If 'pause_when_complete' is set, this behavior changes |
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.
* or an error occurs. If 'pause_when_complete' is set, this behavior changes | |
* or an error occurs. If 'pause_when_complete' on the `interactivetx_context` is set, this behavior changes |
struct interactivetx_context { | ||
|
||
/* Users can set this to their own context */ | ||
void *ctx; |
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.
ctx
means "allocation context", should we call it data_ptr
?
char *error = NULL; | ||
struct wally_psbt *next_psbt; | ||
|
||
if (ictx->current_psbt == NULL) |
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.
move this to the new_itctx
method?
common/interactivetx.c
Outdated
* Otherwise we advance `current_psbt` to `next_psbt` and begin | ||
* processing the change set in `ictx->change_set` */ | ||
if (ictx->current_psbt != next_psbt) { | ||
tal_free(ictx->current_psbt); |
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.
cannot free this until the change_set
is free'd!
struct channel_id *cid = &ictx->channel_id; | ||
struct psbt_changeset *set = ictx->change_set; | ||
u64 serial_id; | ||
u8 *msg = NULL; |
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.
do not set msg
here, leave for later code to fill in.
Gotcha, I'll shepherd this through CI and merge ASAP ^^ ACK 6f1f6e7 |
141f96c
to
2fae6ba
Compare
Takes the dualopen collaborative transaction building and makes it available for other daemons to use Changelog-Added: Added interactive transaction building routine
2fae6ba
to
1bb20c3
Compare
And internal changes don't get CHANGELOG entries, so removed "- Added interactive transaction building routine ([ElementsProject#5287])". We need to come up with some way of marking rust crate changes, as it's not immediately obvious what "- cln-plugin" means? Maybe we switch from JSON-RPC to Control as a more general prefix? Signed-off-by: Rusty Russell <[email protected]>
And internal changes don't get CHANGELOG entries, so removed "- Added interactive transaction building routine ([ElementsProject#5287])". We need to come up with some way of marking rust crate changes, as it's not immediately obvious what "- cln-plugin" means? Maybe we switch from JSON-RPC to Control as a more general prefix? Signed-off-by: Rusty Russell <[email protected]>
And internal changes don't get CHANGELOG entries, so removed "- Added interactive transaction building routine ([#5287])". We need to come up with some way of marking rust crate changes, as it's not immediately obvious what "- cln-plugin" means? Maybe we switch from JSON-RPC to Control as a more general prefix? Signed-off-by: Rusty Russell <[email protected]>
And internal changes don't get CHANGELOG entries, so removed "- Added interactive transaction building routine ([ElementsProject#5287])". We need to come up with some way of marking rust crate changes, as it's not immediately obvious what "- cln-plugin" means? Maybe we switch from JSON-RPC to Control as a more general prefix? Signed-off-by: Rusty Russell <[email protected]>
And internal changes don't get CHANGELOG entries, so removed "- Added interactive transaction building routine ([ElementsProject#5287])". We need to come up with some way of marking rust crate changes, as it's not immediately obvious what "- cln-plugin" means? Maybe we switch from JSON-RPC to Control as a more general prefix? Signed-off-by: Rusty Russell <[email protected]>
Takes @niftynei's dualopen collaborative transaction building and makes it available for other daemons to use.
This is to make it available for channeld to do splicing and also other code that may want to us it in the future!