From 45abe0c50d85cc15252975935e973bc722f84b78 Mon Sep 17 00:00:00 2001 From: Thibaut Le Guilly Date: Thu, 17 Dec 2020 16:37:14 +0900 Subject: [PATCH] Fix contract id computation (#124) --- Protocol.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Protocol.md b/Protocol.md index 3a968eb..02abc45 100644 --- a/Protocol.md +++ b/Protocol.md @@ -18,8 +18,8 @@ Prior to a contract being accepted, a `temporary_contract_id` is used, which is the SHA256 hash of the offer message. Most messages use a `contract_id` to identify the contract. It's -derived from the funding transaction and the offer by combining the `funding_txid` -and the `funding_output_index` and the `temporary_contract_id`, using big-endian +derived from the funding transaction and the offer by combining the `funding_txid`, +the `funding_output_index` and the `temporary_contract_id`, using big-endian exclusive-OR (i.e. `funding_output_index` alters the last 2 bytes of `funding_txid XOR temporary_contract_id`). @@ -212,7 +212,7 @@ This message introduces the [`contract_id`](#definition-of-contract_id) to ident The sender MUST: - - set `contract_id` by exclusive-OR of the `funding_txid` and the `funding_output_index` from the `offer_dlc` and `accept_dlc` messages. + - set `contract_id` by exclusive-OR of the `funding_txid`, the `funding_output_index` and the `temporary_contract_id` from the `offer_dlc` and `accept_dlc` messages. - 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).