-
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
Add and use support for pulling tx without PSBT wrappers #6983
Conversation
Thanks @jgriffiths this looks great, and I'm glad to see some of the utilities we open-coded in CLN making their way back into libwally 👍 I'll wait for @grubles to confirm that this works, and then merge it. In the meantime I think your script change in the last commit could give us a speed boost and so I'm benchmarking a blockchain sync with and without this change to quantify 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.
ACK fe96d3a
This looks good to me and my node is syncing with the liquid chain. It is not difficult to get a pegin transaction while syncing, so currently there is no crash.
Thanks for push this work on the final line
ACK fe96d3a Builds and syncs with |
Awesome, thanks @cdecker
Worth noting that nothing has moved from cln to wally. The removed code was either added to wally for other purposes or was already in wally (but not exposed through its api,) and was exposed for 1.0.0. I say this is worth mentioning because there is code in cln that should move to wally, I'm thinking particularly of the taproot code outside of the keypath spending support gsanders and I worked to merge last year. Also the previous iteration of the wally update PR removed a large amount of code relating to witness serialization but I had to pull it out as no-one helped me figure out how it was upsetting tal. Unfortunately I don't have time to work on this exclusively, but I would be happy to work with someone to get code into wally where it can help others who need e.g. taproot support.
That change and your alloc removal will help, but note that your changes will be lost in the noise of the rest of that PR. In order of effect, the changes in this PR that will improve speed should be:
If block processing in particular is a concern, one easy win I noticed but didn't make is to remove the top level edit: I've made the above change to avoid the tal overhead, and also added early-exit for pegin, fee and cant-possibly-be-p2wsh outputs. |
9062395
to
5f0712a
Compare
Oh yeah, I meant more as in the use-cases we needed in CLN seem to be shared, rather than the code. Thanks for the detailed answer too, it'd certainly be useful to consolidate on I also finally managed to get benchmarks working, which was strange since the bitcoind backend was slower than CLN could process them :-) Awesome find on that redundant |
Probably no point optimising further for now then :) I suspect the rpc overhead is what make this true. The absolute fastest way to do initial sync if the core block files are available would be to use an extremely cut-down block parser based on e.g. https://github.com/rustyrussell/bitcoin-iterate. With an interface that just returns each tx in the block as a pointer + length, the block txs could be constructed directly from the memmapped bytes without rpc overhead and without bin<>hex conversion. At the expense of having more code to maintain you could leave some of the parsing code intact and pass the filter criteria into the call so that filtered txs are skipped completely without even creating them. |
Rename the offending functions from wally_foo to cln_wally_foo. For the sake of a minimal diff, only calls which conflict with wally v1.0.0 have been changed. However it is bad form to use the wally_ function namespace; the remaining such calls should also be renamed. Changelog-None Signed-off-by: Jon Griffiths <[email protected]>
Also removes incorrect/redundant configure flags when building. Changelog-Changed: Update libwally to 1.0.0 Signed-off-by: Jon Griffiths <[email protected]>
As of wally v1.0.0, Elements/Liquid support is enabled and part of the library ABI by default. Changelog-None Signed-off-by: Jon Griffiths <[email protected]>
Wally release builds are significantly faster than debug builds. Plus we pass down our build flags to libsecp, which means release builds have been disabling the asm optimisations for both libraries. Changelog-Changed: Enable optimizations for libwally/libsecp256k1-zkp Signed-off-by: Jon Griffiths <[email protected]>
Changelog-None Signed-off-by: Jon Griffiths <[email protected]>
Changelog-None Signed-off-by: Jon Griffiths <[email protected]>
Changelog-None Signed-off-by: Jon Griffiths <[email protected]>
Input cloning has not been exposed yet; I'll add that to wally in a future release. Changelog-None Signed-off-by: Jon Griffiths <[email protected]>
There are many contexts in which it doesn't make sense to create a PSBT wrapping the tx. There are also tx features that are not supported in wallys PSBT implementation yet (such as pegins), which fail if a PSBT wrapper is created, even though such features are unlikely to ever be used in txs that cln will create/manipulate. Allow these cases to be explicit that they only want the tx. This avoids hitting such errors, is clearer on the caller side, and is more efficient. Changelog-None Signed-off-by: Jon Griffiths <[email protected]>
Changelog-None Signed-off-by: Jon Griffiths <[email protected]>
Changelog-None Signed-off-by: Jon Griffiths <[email protected]>
…way again Changelog-None Signed-off-by: Jon Griffiths <[email protected]>
…ock txs Changelog-None Signed-off-by: Jon Griffiths <[email protected]>
- Avoid overhead from tal checks when iterating block txs - Skip pegin txs as well as coinbase txs while iterating - Early-exit if the txout cannot possibly be p2wsh - Don't re-calculate the txid when we already have it - Don't allocate a script for non-policy asset outputs - Don't copy txids for non-interesting UTXOs Note the below -Changed line covers the previous wally and PSBT commits which also provide general block processing speedups. Changelog-Changed: core: Processing blocks should now be faster Signed-off-by: Jon Griffiths <[email protected]>
Removes the tal_count checking overhead when iterating constant arrays. Separated from the previous commit to make review easier. Changelog-None Signed-off-by: Jon Griffiths <[email protected]>
Includes #6882 which is rebased and I reckon is ready to merge.
Supersedes #6975, @vincenzopalazzo @grubles your review/testing would be appreciated.
Fixes #6975
Fixes #6955