Skip to content

Elements psbt updates #218

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

Closed
wants to merge 36 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
32fc6ca
psbt: Remove the dummy malloc hack for detecting duplicate empty keys
jgriffiths Aug 14, 2020
dbc634c
psbt: Change the elements key prefix from 'Elements' to 'pset'
jgriffiths Aug 14, 2020
99465d7
psbt: Add Elements pegin witness to psbt inputs
jgriffiths Aug 14, 2020
487acbc
psbt: share code to pull transactions, minor cleanups
jgriffiths Aug 14, 2020
7db9a7d
psbt: share code to check for elements keys
jgriffiths Aug 14, 2020
a7bf90a
psbt: share code for setting varbuf members
jgriffiths Aug 15, 2020
da77bee
psbt: share error handling code
jgriffiths Aug 15, 2020
741b7f6
psbt: add Elements global scalar offset
jgriffiths Aug 17, 2020
f32b149
psbt: rename value on inputs to pegin_value
jgriffiths Aug 17, 2020
f50ba57
psbt: rename claim_script to pegin_claim_script
jgriffiths Aug 17, 2020
70188dd
psbt: rename genesis_blockhash on inputs to pegin_genesis_blockhash
jgriffiths Aug 17, 2020
f496bb5
psbt: rename txoutproof on inputs to pegin_txoutproof
jgriffiths Aug 17, 2020
8ad6c27
psbt: remove abf from inputs and replace with inflation_keys_rangeproof
jgriffiths Aug 17, 2020
f8fdf1a
psbt: fix warning when building without elements support
jgriffiths Aug 17, 2020
04093e9
psbt: remove asset from inputs and replace with issuance_amount_range…
jgriffiths Aug 17, 2020
0a116f1
psbt: remove vbf from inputs and replace with issuance_amount
jgriffiths Aug 17, 2020
56c463d
psbt: add issuance_value to inputs
jgriffiths Aug 17, 2020
8b9c9fe
psbt: create generic macros for exposing nested structs to swig
jgriffiths Aug 18, 2020
baf4ccf
psbt: rename issusance value fields to amount
jgriffiths Aug 18, 2020
01807e2
psbt: rename nonce to ecdh_pub_key in outputs
jgriffiths Aug 20, 2020
56f4abe
psbt: change abf to asset and re-number
jgriffiths Aug 20, 2020
39d7750
psbt: change blinding_pubkey -> blinding_pub_key to match other wally…
jgriffiths Aug 20, 2020
128e5cd
psbt: re-number value_commitment in output to match new spec, reorder…
jgriffiths Aug 20, 2020
835fd1b
psbt: replace vbf with optional value in output
jgriffiths Aug 20, 2020
485808d
psbt: Allow using setters to set nested members, do so for inputs/out…
jgriffiths Aug 20, 2020
14e0162
psbt: use a single macro to handle all varbuff setters
jgriffiths Aug 21, 2020
7430f16
python: Allow returning empty buffers from varbuff wrappers
jgriffiths Aug 21, 2020
bde6676
psbt: implement mutual exclusivity for blinded/unblinded amounts"
jgriffiths Aug 21, 2020
d2b1371
psbt: combining blinded and unblinded outputs is now an error
jgriffiths Aug 23, 2020
debf60b
psbt: add blinding index to outputs
jgriffiths Aug 23, 2020
5dbf005
psbt: Allow doubly-present but matching fields when combining exclusi…
jgriffiths Aug 23, 2020
8cbb58b
psbt: change global scalar from a single item to a map of scalars
jgriffiths Sep 24, 2020
b2d2aa5
psbt: Expose unknown map getters/setters to swig, make global_scalar_…
jgriffiths Sep 25, 2020
db4b0a4
psbt: add round trip serialization tests after every setter call
jgriffiths Sep 25, 2020
ebd3d8f
SWIG: Preprocess our internal header and use that when calling swig
jgriffiths Dec 2, 2020
973bc70
psbt: Update missed java wrapper
jgriffiths Dec 3, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 90 additions & 33 deletions include/wally.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1353,32 +1353,61 @@ inline int psbt_elements_init_alloc(uint32_t version, size_t inputs_allocation_l
return ret;
}

inline int psbt_input_clear_value(struct wally_psbt_input* input) {
int ret = ::wally_psbt_input_clear_value(input);
inline int psbt_input_clear_issuance_amount(struct wally_psbt_input* input) {
int ret = ::wally_psbt_input_clear_issuance_amount(input);
return ret;
}

template <class INPUT, class ABF>
inline int psbt_input_set_abf(const INPUT& input, const ABF& abf) {
int ret = ::wally_psbt_input_set_abf(detail::get_p(input), abf.data(), abf.size());
inline int psbt_input_clear_pegin_value(struct wally_psbt_input* input) {
int ret = ::wally_psbt_input_clear_pegin_value(input);
return ret;
}

template <class INPUT, class ASSET>
inline int psbt_input_set_asset(const INPUT& input, const ASSET& asset) {
int ret = ::wally_psbt_input_set_asset(detail::get_p(input), asset.data(), asset.size());
template <class INPUT>
inline int psbt_input_has_issuance_amount(const INPUT& input, size_t* written) {
int ret = ::wally_psbt_input_has_issuance_amount(detail::get_p(input), written);
return ret;
}

template <class INPUT>
inline int psbt_input_has_pegin_value(const INPUT& input, size_t* written) {
int ret = ::wally_psbt_input_has_pegin_value(detail::get_p(input), written);
return ret;
}

template <class INPUT, class INFLATION_KEYS_RANGEPROOF>
inline int psbt_input_set_inflation_keys_rangeproof(const INPUT& input, const INFLATION_KEYS_RANGEPROOF& inflation_keys_rangeproof) {
int ret = ::wally_psbt_input_set_inflation_keys_rangeproof(detail::get_p(input), inflation_keys_rangeproof.data(), inflation_keys_rangeproof.size());
return ret;
}

template <class INPUT>
inline int psbt_input_set_issuance_amount(const INPUT& input, uint64_t value) {
int ret = ::wally_psbt_input_set_issuance_amount(detail::get_p(input), value);
return ret;
}

template <class INPUT, class COMMITMENT>
inline int psbt_input_set_issuance_amount_commitment(const INPUT& input, const COMMITMENT& commitment) {
int ret = ::wally_psbt_input_set_issuance_amount_commitment(detail::get_p(input), commitment.data(), commitment.size());
return ret;
}

template <class INPUT, class ISSUANCE_AMOUNT_RANGEPROOF>
inline int psbt_input_set_issuance_amount_rangeproof(const INPUT& input, const ISSUANCE_AMOUNT_RANGEPROOF& issuance_amount_rangeproof) {
int ret = ::wally_psbt_input_set_issuance_amount_rangeproof(detail::get_p(input), issuance_amount_rangeproof.data(), issuance_amount_rangeproof.size());
return ret;
}

template <class INPUT, class SCRIPT>
inline int psbt_input_set_claim_script(const INPUT& input, const SCRIPT& script) {
int ret = ::wally_psbt_input_set_claim_script(detail::get_p(input), script.data(), script.size());
inline int psbt_input_set_pegin_claim_script(const INPUT& input, const SCRIPT& script) {
int ret = ::wally_psbt_input_set_pegin_claim_script(detail::get_p(input), script.data(), script.size());
return ret;
}

template <class INPUT, class GENESIS_BLOCKHASH>
inline int psbt_input_set_genesis_blockhash(const INPUT& input, const GENESIS_BLOCKHASH& genesis_blockhash) {
int ret = ::wally_psbt_input_set_genesis_blockhash(detail::get_p(input), genesis_blockhash.data(), genesis_blockhash.size());
inline int psbt_input_set_pegin_genesis_blockhash(const INPUT& input, const GENESIS_BLOCKHASH& genesis_blockhash) {
int ret = ::wally_psbt_input_set_pegin_genesis_blockhash(detail::get_p(input), genesis_blockhash.data(), genesis_blockhash.size());
return ret;
}

Expand All @@ -1389,26 +1418,48 @@ inline int psbt_input_set_pegin_tx(const INPUT& input, const struct wally_tx* pe
}

template <class INPUT, class PROOF>
inline int psbt_input_set_txoutproof(const INPUT& input, const PROOF& proof) {
int ret = ::wally_psbt_input_set_txoutproof(detail::get_p(input), proof.data(), proof.size());
inline int psbt_input_set_pegin_txoutproof(const INPUT& input, const PROOF& proof) {
int ret = ::wally_psbt_input_set_pegin_txoutproof(detail::get_p(input), proof.data(), proof.size());
return ret;
}

template <class INPUT>
inline int psbt_input_set_value(const INPUT& input, uint64_t value) {
int ret = ::wally_psbt_input_set_value(detail::get_p(input), value);
inline int psbt_input_set_pegin_value(const INPUT& input, uint64_t value) {
int ret = ::wally_psbt_input_set_pegin_value(detail::get_p(input), value);
return ret;
}

template <class INPUT, class VBF>
inline int psbt_input_set_vbf(const INPUT& input, const VBF& vbf) {
int ret = ::wally_psbt_input_set_vbf(detail::get_p(input), vbf.data(), vbf.size());
template <class INPUT>
inline int psbt_input_set_pegin_witness(const INPUT& input, const struct wally_tx_witness_stack* pegin_witness) {
int ret = ::wally_psbt_input_set_pegin_witness(detail::get_p(input), pegin_witness);
return ret;
}

template <class OUTPUT, class ABF>
inline int psbt_output_set_abf(const OUTPUT& output, const ABF& abf) {
int ret = ::wally_psbt_output_set_abf(detail::get_p(output), abf.data(), abf.size());
inline int psbt_output_clear_blinding_index(struct wally_psbt_output* output) {
int ret = ::wally_psbt_output_clear_blinding_index(output);
return ret;
}

inline int psbt_output_clear_value(struct wally_psbt_output* output) {
int ret = ::wally_psbt_output_clear_value(output);
return ret;
}

template <class OUTPUT>
inline int psbt_output_has_blinding_index(const OUTPUT& output, size_t* written) {
int ret = ::wally_psbt_output_has_blinding_index(detail::get_p(output), written);
return ret;
}

template <class OUTPUT>
inline int psbt_output_has_value(const OUTPUT& output, size_t* written) {
int ret = ::wally_psbt_output_has_value(detail::get_p(output), written);
return ret;
}

template <class OUTPUT, class ASSET>
inline int psbt_output_set_asset(const OUTPUT& output, const ASSET& asset) {
int ret = ::wally_psbt_output_set_asset(detail::get_p(output), asset.data(), asset.size());
return ret;
}

Expand All @@ -1418,15 +1469,21 @@ inline int psbt_output_set_asset_commitment(const OUTPUT& output, const COMMITME
return ret;
}

template <class OUTPUT>
inline int psbt_output_set_blinding_index(const OUTPUT& output, uint32_t blinding_index) {
int ret = ::wally_psbt_output_set_blinding_index(detail::get_p(output), blinding_index);
return ret;
}

template <class OUTPUT, class PUB_KEY>
inline int psbt_output_set_blinding_pubkey(const OUTPUT& output, const PUB_KEY& pub_key) {
int ret = ::wally_psbt_output_set_blinding_pubkey(detail::get_p(output), pub_key.data(), pub_key.size());
inline int psbt_output_set_blinding_pub_key(const OUTPUT& output, const PUB_KEY& pub_key) {
int ret = ::wally_psbt_output_set_blinding_pub_key(detail::get_p(output), pub_key.data(), pub_key.size());
return ret;
}

template <class OUTPUT, class NONCE>
inline int psbt_output_set_nonce(const OUTPUT& output, const NONCE& nonce) {
int ret = ::wally_psbt_output_set_nonce(detail::get_p(output), nonce.data(), nonce.size());
template <class OUTPUT, class PUB_KEY>
inline int psbt_output_set_ecdh_pub_key(const OUTPUT& output, const PUB_KEY& pub_key) {
int ret = ::wally_psbt_output_set_ecdh_pub_key(detail::get_p(output), pub_key.data(), pub_key.size());
return ret;
}

Expand All @@ -1442,15 +1499,15 @@ inline int psbt_output_set_surjectionproof(const OUTPUT& output, const PROOF& pr
return ret;
}

template <class OUTPUT, class COMMITMENT>
inline int psbt_output_set_value_commitment(const OUTPUT& output, const COMMITMENT& commitment) {
int ret = ::wally_psbt_output_set_value_commitment(detail::get_p(output), commitment.data(), commitment.size());
template <class OUTPUT>
inline int psbt_output_set_value(const OUTPUT& output, uint64_t value) {
int ret = ::wally_psbt_output_set_value(detail::get_p(output), value);
return ret;
}

template <class OUTPUT, class VBF>
inline int psbt_output_set_vbf(const OUTPUT& output, const VBF& vbf) {
int ret = ::wally_psbt_output_set_vbf(detail::get_p(output), vbf.data(), vbf.size());
template <class OUTPUT, class COMMITMENT>
inline int psbt_output_set_value_commitment(const OUTPUT& output, const COMMITMENT& commitment) {
int ret = ::wally_psbt_output_set_value_commitment(detail::get_p(output), commitment.data(), commitment.size());
return ret;
}

Expand Down
Loading