--- Log opened Sun Mar 13 00:00:26 2022 12:22 < sanket1729> andytoshi: one API question about finalizepsbt. The current behaviour is that if finalization fails at psbt input i, all inputs till i-1 are finalized. Is this behavior okay? Should we change the psbt finalize to take &self and return a new Psbt struct 12:24 < sanket1729> It seems wasteful to create a new psbt when we only want to set new two fields and remove a bunch of fields. 12:26 < andytoshi> sanket1729: i think that all inputs should be finalized except the ones that fail 12:26 < andytoshi> so everything from i-1, and everything from i+1 onward 12:27 < sanket1729> How about the return err then? 12:27 < sanket1729> Should it Vec? 12:27 < sanket1729> for all inputs that fail? 12:27 < andytoshi> yeah, i think so 12:27 < andytoshi> and it should be a tuple rather than a Result 12:27 < sanket1729> What should be tuple? 12:27 < sanket1729> The return type 12:28 < sanket1729> Makes sense 12:29 < sanket1729> I think it might be better idea to drop the `finalize` and only expose `finalize_input`. Have the users loop over them 12:29 < sanket1729> So, we don't have to deal with these cases. And the user can cleanly decide based on what it needs. 12:29 < andytoshi> i wouldn't mind having both 12:30 < andytoshi> `finalize` would be a pretty short function to write 12:30 < andytoshi> it just does the loop and collects the errors 12:30 < sanket1729> Fair point. 12:30 < andytoshi> we'd document that users who want more precise control need to call `finalize_input` themselves 12:31 < sanket1729> I like it 12:32 < andytoshi> dope 12:39 < sanket1729> andytoshi: I think the return type would still be Result<(), Vec>. What is tuple return type that you are suggesting? 12:43 < andytoshi> sanket1729: oops, i was thinking (Psbt, Vec) 12:43 < andytoshi> but actually we don't want to return the original psbt 12:43 < andytoshi> or any psbt 12:44 < andytoshi> so yeah, Result<(), Vec> sounds good to me 12:44 < andytoshi> I'd also be ok wiht Vec and the user has to check if the vector is empty 12:46 < sanket1729> I have a slight preference to Result<(), Vec> instead. Returning a result seems more idiomatic 12:48 < andytoshi> sounds good to me 16:59 < jeremyrubin> my preference sanket1729 is to do: Result)> 16:59 < jeremyrubin> that way the API you can write is something like: 16:59 < jeremyrubin> let finished = psbt.finalize()?; 17:00 < jeremyrubin> and if you *do* get a modified PSBT, you can work with the error'd one returned as Err((Psbt, errors)) and you can see which ones actually errored in the vec w/ the index 17:00 < jeremyrubin> altho maybe InputError has an index field already 17:01 < jeremyrubin> if finalize takes psbt instead of &mut psbt i think it's more clear that either you're OK with your psbt getting mut-d, or you have to clone it and then can combine back (if passed in from somewhere else) 17:02 < jeremyrubin> but the returning of the PSBT as a part of the result really helps with making the error handling code cleaner (since you either get an Err((psbt, erros)) or Ok(psbt) v.s. some error you need to check elsewhere --- Log closed Mon Mar 14 00:00:26 2022