PSBT Extensions and Elements PSBT Serialization - #201
Closed
achow101 wants to merge 24 commits into
Closed
Conversation
AFAICT, the below does the same thing, and avoids glslang having to tell me to add my test there. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
As revealed by: make && LD_LIBRARY_PATH=`pwd`/src/.libs valgrind --leak-check=full src/.libs/test_psbt There are more, but the next patches rework that code. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Manually checking for end of buffers is error prone: these pull & push variants are similar to those used by c-lightning. Importantly, if they fail you can still call them, meaning you can check whether it overflowed at the end of all the work. The push function also can tell you exactly how many bytes short you were. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This also means we return WALLY_EINVAL instead of corrupting the stack if they provide a witness output > 50 bytes. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
As a special bonus, document that it now returns bytes_written as the entire length, if the error was caused by bytes_len being insufficient. This allows the caller to avoid calling bytes_len in the common case, if they want to. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
…ytes. This avoid (recently buggy!) duplication. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Now we pull the magic before calling count_psbt_parts(), it no longer needs to skip over it. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This currently fails (badly). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
valgrind is better, but this is simple and finds current leaks. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Byte vectors in a PSBT could have a 0 length and thus result in duplicate keys in a PSBT as length 0 is also assumed that there is no vector for that field. Instead of checking length, check that the pointer is non-null. To ensure the pointers are non-null, malloc 1 byte. The length is still stored as 0.
wally_psbt_elements_init_alloc is added to set an elements magic wally_psbt_init_alloc, wally_psbt_to_bytes, and wally_psbt_from_bytes are updated to deal with this magic instead of the hard coded magic. wally_psbt_is_elements is added.
so it needs the bool header
libwally wants you to flag in what 'type' of transaction it's handling in a few places (in others it seems to be able to figure it out for itself)
This was referenced Jul 13, 2020
Merged
Contributor
|
Closing this in favour of #210 which includes/supersedes it. Please re-open if something you need got missed in the merge. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the extensions to BIP 174 which add a global version field and proprietary types. The elements proprietary fields are implemented here too.
The elements PSBT fields are added to the psbt structs as well as their serialization and deserialization of those fields. None of the roles for elements psbt have been implemented as what they are supposed to do is still being worked out.
Based on #191