Skip to content

Commit 4885480

Browse files
authored
Merge pull request #131 from stejbac/change-musigrpc-txid-fields-to-strings
Change contractual txid fields to strings in `rpc.proto`
2 parents 1f05b93 + 59fde66 commit 4885480

3 files changed

Lines changed: 38 additions & 40 deletions

File tree

rpc/build.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
2626
// Add Serde serialization for musigrpc request types...
2727
.serde_serialized_types(&[
2828
"ReceiverAddressAndAmount", "PartialSignaturesRequest", "DepositTxSignatureRequest",
29-
"PublishDepositTxRequest", "SubscribeTxConfirmationStatusRequest"
30-
])
31-
.serde_serialized_type("ContractualTxIds", &[
32-
rev_hex("depositTxId"), rev_hex("buyersWarningTxId"), rev_hex("sellersWarningTxId"),
33-
rev_hex("buyersRedirectTxId"), rev_hex("sellersRedirectTxId")
29+
"PublishDepositTxRequest", "SubscribeTxConfirmationStatusRequest", "ContractualTxIds"
3430
])
3531
.serde_serialized_type("PubKeySharesRequest", &[
3632
enum_field("myRole", "Role")

rpc/src/main/proto/rpc.proto

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ message ReceiverAddressAndAmount {
3333
}
3434

3535
message ContractualTxIds {
36-
bytes depositTxId = 1;
37-
bytes buyersWarningTxId = 2;
38-
bytes sellersWarningTxId = 3;
39-
bytes buyersRedirectTxId = 4;
40-
bytes sellersRedirectTxId = 5;
36+
string depositTxId = 1;
37+
string buyersWarningTxId = 2;
38+
string sellersWarningTxId = 3;
39+
string buyersRedirectTxId = 4;
40+
string sellersRedirectTxId = 5;
4141
}
4242

4343
message PubKeySharesRequest {
@@ -48,41 +48,43 @@ message PubKeySharesRequest {
4848
message PubKeySharesResponse {
4949
bytes buyerOutputPubKeyShare = 1;
5050
bytes sellerOutputPubKeyShare = 2;
51-
uint32 currentBlockHeight = 3;
51+
// bytes multisigScriptKey = 3; TODO: Uncomment - provisionally added to Bisq2 side.
52+
uint32 currentBlockHeight = 4;
5253
}
5354

5455
message NonceSharesRequest {
5556
string tradeId = 1;
5657
bytes buyerOutputPeersPubKeyShare = 2;
5758
bytes sellerOutputPeersPubKeyShare = 3;
58-
uint64 depositTxFeeRate = 4; // sats per kwu
59-
uint64 preparedTxFeeRate = 5; // sats per kwu
60-
uint64 tradeAmount = 6; // sats
61-
uint64 buyersSecurityDeposit = 7; // sats
62-
uint64 sellersSecurityDeposit = 8; // sats
63-
ReceiverAddressAndAmount tradeFeeReceiver = 9;
59+
// bytes peersMultisigScriptKey = 4; TODO: Uncomment - provisionally added to Bisq2 side.
60+
uint64 depositTxFeeRate = 5; // sats per kwu
61+
uint64 preparedTxFeeRate = 6; // sats per kwu
62+
uint64 tradeAmount = 7; // sats
63+
uint64 buyersSecurityDeposit = 8; // sats
64+
uint64 sellersSecurityDeposit = 9; // sats
65+
optional ReceiverAddressAndAmount tradeFeeReceiver = 10;
6466
}
6567

6668
message NonceSharesMessage {
6769
string warningTxFeeBumpAddress = 1;
6870
string redirectTxFeeBumpAddress = 2;
69-
string claimTxPayoutAddress = 11;
70-
bytes halfDepositPsbt = 3;
71-
uint64 redirectionAmountMsat = 14; // (millisatoshis)
72-
bytes swapTxInputNonceShare = 4;
73-
bytes buyersWarningTxBuyerInputNonceShare = 5;
74-
bytes buyersWarningTxSellerInputNonceShare = 6;
75-
bytes sellersWarningTxBuyerInputNonceShare = 7;
76-
bytes sellersWarningTxSellerInputNonceShare = 8;
77-
bytes buyersRedirectTxInputNonceShare = 9;
78-
bytes sellersRedirectTxInputNonceShare = 10;
79-
bytes buyersClaimTxInputNonceShare = 12;
80-
bytes sellersClaimTxInputNonceShare = 13;
71+
string claimTxPayoutAddress = 3;
72+
bytes halfDepositPsbt = 4;
73+
uint64 redirectionAmountMsat = 5; // (millisatoshis)
74+
bytes swapTxInputNonceShare = 6;
75+
bytes buyersWarningTxBuyerInputNonceShare = 7;
76+
bytes buyersWarningTxSellerInputNonceShare = 8;
77+
bytes sellersWarningTxBuyerInputNonceShare = 9;
78+
bytes sellersWarningTxSellerInputNonceShare = 10;
79+
bytes buyersRedirectTxInputNonceShare = 11;
80+
bytes sellersRedirectTxInputNonceShare = 12;
81+
bytes buyersClaimTxInputNonceShare = 13;
82+
bytes sellersClaimTxInputNonceShare = 14;
8183
}
8284

8385
message PartialSignaturesRequest {
8486
string tradeId = 1;
85-
NonceSharesMessage peersNonceShares = 2;
87+
optional NonceSharesMessage peersNonceShares = 2;
8688
repeated ReceiverAddressAndAmount redirectionReceivers = 3;
8789
bool buyerReadyToRelease = 4;
8890
}
@@ -91,10 +93,10 @@ message PartialSignaturesMessage {
9193
bytes peersWarningTxBuyerInputPartialSignature = 1;
9294
bytes peersWarningTxSellerInputPartialSignature = 2;
9395
bytes peersRedirectTxInputPartialSignature = 3;
94-
bytes peersClaimTxInputPartialSignature = 6;
95-
optional bytes swapTxInputPartialSignature = 4;
96-
optional bytes swapTxInputSighash = 5;
97-
ContractualTxIds contractualTxIds = 7;
96+
bytes peersClaimTxInputPartialSignature = 4;
97+
optional bytes swapTxInputPartialSignature = 5;
98+
optional bytes swapTxInputSighash = 6;
99+
optional ContractualTxIds contractualTxIds = 7;
98100
}
99101

100102
message DepositTxSignatureRequest {

rpc/src/pb/convert.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -246,14 +246,14 @@ impl From<SentAddressesNoncesPair<'_>> for NonceSharesMessage {
246246
}
247247
}
248248

249-
impl From<ContractualTxids> for crate::pb::musigrpc::ContractualTxIds {
249+
impl From<ContractualTxids> for musigrpc::ContractualTxIds {
250250
fn from(value: ContractualTxids) -> Self {
251251
Self {
252-
deposit_tx_id: value.deposit.to_byte_array().into(),
253-
buyers_warning_tx_id: value.buyers_warning.to_byte_array().into(),
254-
sellers_warning_tx_id: value.sellers_warning.to_byte_array().into(),
255-
buyers_redirect_tx_id: value.buyers_redirect.to_byte_array().into(),
256-
sellers_redirect_tx_id: value.sellers_redirect.to_byte_array().into(),
252+
deposit_tx_id: value.deposit.to_string(),
253+
buyers_warning_tx_id: value.buyers_warning.to_string(),
254+
sellers_warning_tx_id: value.sellers_warning.to_string(),
255+
buyers_redirect_tx_id: value.buyers_redirect.to_string(),
256+
sellers_redirect_tx_id: value.sellers_redirect.to_string(),
257257
}
258258
}
259259
}

0 commit comments

Comments
 (0)