-
Notifications
You must be signed in to change notification settings - Fork 21
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
updatespendtx
: merge signatures, don't overwrite the PSBT entirely
#312
Comments
Some clarifications about this. The Instead of overwriting it, it would be preferable to query the in-DB PSBT, add to it the signatures from the new PSBT and then store it. Make sure to use |
Hey, To update the progress, I'll list out the steps that I planned on taking
Although the suggested way was to call
I haven't checked if there is any way of typecasting |
Sounds good to me.
First of all, note how those two functions you talk about trust their inputs. For instance: revaultd/src/database/actions.rs Line 769 in 457ff85
That's because they are internal helpers working with data internal to the DB. Using such functions with inputs from the RPC would mean that we'd have to sanitize inputs first, and the easiest way of doing that is to use the add_signature API from revault_tx . Therefore we'd just be doing the work twice.
Secondly, those helpers are specific to presigned transactions (Unvault, Cancel and bother Emergency) which are managed separately from the Spend transactions in database: revaultd/src/database/schema.rs Lines 74 to 123 in 457ff85
Lastly, i'd like to get rid of these ugly hacks that |
Hey, continuing on this issue, I encountered more problem. Before I enumerate them, I thought I'll go through the process. First, I looked at the source code of let signatures: Vec<BTreeMap<BitcoinPubKey, Vec<u8>>> = old_tx
.unwrap()
.psbt
.psbt()
.inputs
.iter()
.map(|i| i.partial_sigs.clone())
.collect(); Then I iterate over them and then add the signature to But do I have to also any other expected error that the system could encounter while adding the new signatures? If it's more convenient, I can create a PR and then there will be more context to what I'm referring to. |
I think Lines 1245 to 1247 in 457ff85
It doesn't expect an error, it asserts that |
Since I'm going to use Lines 441 to 448 in b310208
|
Why wouldn't you?
As previously stated, i think it should be done on the PSBT from the DB. It just sounds "safer". |
0e80faf Merging functionality in `update_spend_tx`. Along with doc change & the required test. (Zshan0) Pull request description: Currently, `update_spend_tx` over-writes the partial signatures that are present in the database with the signatures of the given `spend_tx`. To avoid this, the suggested change in #312 was to merge the older and the newer signatures together and save it in the database. The corresponding test and the API documentation have been updated with the same ACKs for top commit: darosior: ACK 0e80faf Tree-SHA512: 2dabe11bf1949fd3e62a815d0c30c5603dbeebc26eaa9458e92c6d88be4f53b1a59b9980616650c199906633598fab11eedc3a94c181a36b48041e1b7d31f543
This was fixed by #391. |
It would greatly improve the UX in the GUI (because it wouldn't discard existing signatures).
The text was updated successfully, but these errors were encountered: