diff --git a/Messaging.md b/Messaging.md index 77def64..e55ed5f 100644 --- a/Messaging.md +++ b/Messaging.md @@ -29,12 +29,12 @@ All data fields are unsigned big-endian unless otherwise specified. - [Version 0 `negotiation_fields`](#version-0-negotiation_fields) - [Version 1 `negotiation_fields`](#version-1-negotiation_fields) - [Version 2 `negotiation_fields`](#version-2-negotiation_fields) - - [The `funding_input` Type](#the-funding_input-type) - - [Version 0 `funding_input`](#version-0-funding_input) + - [The `input` Type](#the-input-type) + - [Version 0 `input`](#version-0-input) - [The `cet_adaptor_signatures` Type](#the-cet_adaptor_signatures-type) - [Version 0 `cet_adaptor_signatures`](#version-0-cet_adaptor_signatures) - - [The `funding_signatures` Type](#the-funding_signatures-type) - - [Version 0 `funding_signatures`](#version-0-funding_signatures) + - [The `input_signatures` Type](#the-input_signatures-type) + - [Version 0 `input_signatures`](#version-0-input_signatures) - [The `event_descriptor` Type](#the-event_descriptor-type) - [Version 0 `enum_event_descriptor`](#version-0-enum_event_descriptor) - [Version 0 `digit_decomposition_event_descriptor`](#version-0-digit_decomposition_event_descriptor) @@ -258,13 +258,13 @@ This type is used within `dlc_accept` messages that respond to `dlc_offer`s cont The `num_disjoint_events` here must be equal to the `num_disjoint_events` in that `contract_info_v1` and all of the `negotiation_fields` nested here must be version 0 or 1. -### The `funding_input` Type +### The `input` Type -This type contains information about a specific input to be used in a funding transaction, as well as its corresponding on-chain UTXO. +This type contains information about a specific input to be used in a funding or closing transaction, as well as its corresponding on-chain UTXO. -#### Version 0 `funding_input` +#### Version 0 `input` -1. type: 42772 (`funding_input_v0`) +1. type: 42772 (`input_v0`) 2. data: * [`u64`:`input_serial_id`] * [`u16`:`prevtx_len`] @@ -281,7 +281,7 @@ Inputs in the funding transaction will be sorted by `input_serial_id`. The transaction is used to validate this spent output's value and to validate that it is a SegWit output. `max_witness_len` is the total serialized length of the witness data that will be supplied -(e.g. sizeof(varint) + sizeof(witness) for each) in `funding_signatures`. +(e.g. sizeof(varint) + sizeof(witness) for each) in `input_signatures`. `redeemscript` the witness script public key to be revealed for P2SH spending. Only applicable for P2SH-wrapped inputs. @@ -307,13 +307,13 @@ This type contains CET signatures and any necessary information linking the sign This type should be used with [`contract_info_v0`](#version-0-contract_info) where each indexed signature in the data corresponds to the outcome of the same index. -### The `funding_signatures` Type +### The `input_signatures` Type -This type contains signatures of the funding transaction and any necessary information linking the signatures to their inputs. +This type contains signatures of the funding or closing transaction and any necessary information linking the signatures to their inputs. -#### Version 0 `funding_signatures` +#### Version 0 `input_signatures` -1. type: 42776 (`funding_signatures_v0`) +1. type: 42776 (`input_signatures_v0`) 2. data: * [`u16`:`num_witnesses`] * [`u16`:`num_witness_elems_1`] @@ -329,7 +329,7 @@ This type contains signatures of the funding transaction and any necessary infor `witness` is the data for a witness element in a witness stack. An empty `witness_stack` is an error, as every input must be Segwit. Witness elements should *not* include their length as part of the witness data. -Witnesses should be sorted by the `input_serial_id` sent in `funding_input` defining these inputs. +Witnesses should be sorted by the `input_serial_id` sent in funding `input` defining these inputs. ### The `event_descriptor` Type diff --git a/Protocol.md b/Protocol.md index f4e0305..903f708 100644 --- a/Protocol.md +++ b/Protocol.md @@ -75,8 +75,8 @@ the funding transaction and CETs. * [`spk`:`payout_spk`] * [`u64`:`payout_serial_id`] * [`u64`:`offer_collateral_satoshis`] - * [`u16`:`num_funding_inputs`] - * [`num_funding_inputs*funding_input`:`funding_inputs`] + * [`u16`:`num_inputs`] + * [`num_inputs*input`:`inputs`] * [`spk`:`change_spk`] * [`u64`:`change_serial_id`] * [`u64`:`fund_output_serial_id`] @@ -99,8 +99,8 @@ the funding transaction output. `payout_spk` specifies the script pubkey that CETs and the refund transaction should use in the sender's output. `offer_collateral_satoshis` is the amount the sender is putting into the -contract. `num_funding_inputs` is the number of funding inputs contributed by -the sender and `funding_inputs` contains outputs, outpoints, and expected weights +contract. `num_inputs` is the number of funding inputs contributed by +the sender and `inputs` contains outputs, outpoints, and expected weights of the sender's funding inputs. `change_spk` specifies the script pubkey that funding change should be sent to. @@ -162,10 +162,10 @@ The receiving node MUST reject the contract if: - `payout_spk` or `change_spk` are not a [standard script pubkey](#script-pubkey-standardness-definition). - it considers `feerate_per_vb` too small for timely processing or unreasonably large. - `funding_pubkey` is not a valid secp256k1 pubkey in compressed format. - - `funding_inputs` do not contribute at least `total_collateral_satoshis` plus full [fee payment](Transactions.md#fee-payment). + - `inputs` do not contribute at least `total_collateral_satoshis` plus full [fee payment](Transactions.md#fee-payment). - Any `input_serial_id` is duplicated - The `fund_output_serial_id` and `change_serial_id` are not set to different value - - Any input in `funding_inputs` is not a BIP141 (Segregated Witness) input. + - Any input in `inputs` is not a BIP141 (Segregated Witness) input. ### The `accept_dlc` Message @@ -181,8 +181,8 @@ and closing transactions. * [`point`:`funding_pubkey`] * [`spk`:`payout_spk`] * [`u64`:`payout_serial_id`] - * [`u16`:`num_funding_inputs`] - * [`num_funding_inputs*funding_input`:`funding_inputs`] + * [`u16`:`num_inputs`] + * [`num_inputs*input`:`inputs`] * [`spk`:`change_spk`] * [`u64`:`change_serial_id`] * [`cet_adaptor_signatures`:`cet_adaptor_signatures`] @@ -216,11 +216,11 @@ The receiver: - MAY reject the contract. - if `payout_spk` or `change_spk` are not a [standard script pubkey](#script-pubkey-standardness-definition) - MUST reject the contract. - - if any input in `funding_inputs` is not a BIP141 (Segregated Witness) input. + - if any input in `inputs` is not a BIP141 (Segregated Witness) input. - MUST reject the contract. - if `cet_adaptor_signatures` or `refund_signature` fail validation: - MUST reject the contract. - - if `funding_inputs` do not contribute at least `accept_collateral_satoshis` plus [fee payment](Transactions.md#fee-payment) + - if `inputs` do not contribute at least `accept_collateral_satoshis` plus [fee payment](Transactions.md#fee-payment) - MUST reject the contract. - if any `input_serial_id` is duplicated - MUST reject the contract. @@ -246,7 +246,7 @@ This message introduces the [`contract_id`](#definition-of-contract_id) to ident * [`contract_id`:`contract_id`] * [`cet_adaptor_signatures`:`cet_adaptor_signatures`] * [`signature`:`refund_signature`] - * [`funding_signatures`:`funding_signatures`] + * [`input_signatures`:`input_signatures`] #### Requirements @@ -256,7 +256,7 @@ The sender MUST: - set `cet_adaptor_signatures` to valid adaptor signatures, using its `funding_pubkey` for each CET, as defined in the [transaction specification](Transactions.md#contract-execution-transaction) and using signature public keys computed using the `offer_dlc`'s `contract_info` and `oracle_info` as adaptor points. - include an adaptor signature in `cet_adaptor_signatures` for every event specified in the `offer_dlc`'s `contract_info`. - set `refund_signature` to the valid signature, using its `funding_pubkey` for the refund transaction, as defined in the [transaction specification](Transactions.md#refund-transaction). - - set `funding_signatures` to contain valid witnesses for every funding input specified in the `offer_dlc` message and in the same order. + - set `input_signatures` to contain valid witnesses for every funding input specified in the `offer_dlc` message and in the same order. The recipient: @@ -294,12 +294,12 @@ to broadcast a mutual closing transaction. 2. data: * [`32*byte`:`contract_id`] * [`signature`:`close_signature`] - * [`u64`:`offerPayoutSatoshis`] - * [`u64`:`acceptPayoutSatoshis`] + * [`u64`:`offer_payout_satoshis`] + * [`u64`:`accept_payout_satoshis`] * [`u64`:`fund_input_serial_id`] * [`u16`:`num_extra_inputs`] - * [`num_extra_inputs*extra_input`:`extra_inputs`] - * [`extra_signatures`:`extra_signatures`] + * [`num_extra_inputs*input`:`extra_inputs`] + * [`input_signatures`:`input_signatures`] * [`u32`:`close_locktime`] diff --git a/Transactions.md b/Transactions.md index 392b294..2b79b40 100644 --- a/Transactions.md +++ b/Transactions.md @@ -34,7 +34,7 @@ The funding inputs and change output script public keys are negotiated in the of ## Funding Transaction Input and Output Ordering -The inputs are sorted by each `funding_input`'s `input_serial_id` in ascending order. +The inputs are sorted by each funding `input`'s `input_serial_id` in ascending order. The outputs are sorted in ascending order based on their respective `change_serial_id` or `fund_output_serial_id`. ## Funding Inputs diff --git a/test/dlc_message_test.json b/test/dlc_message_test.json index 2c79c74..9dafb93 100644 --- a/test/dlc_message_test.json +++ b/test/dlc_message_test.json @@ -25,7 +25,7 @@ "rValue" : "9e7eaeb2624a93bba2f132da687862f73038c2e5769c812c7b0ba4b654a3e856" } }, { - "tpeName" : "funding_input_v0", + "tpeName" : "input_v0", "input" : "fda71437002902000000000100c2eb0b00000000160014781c327deed64538720dc4c857a0712111020c740000000000000000ffffffff006b0000", "fields" : { "tpe" : "fda714",