Skip to content

Commit c185780

Browse files
committed
Change contractual txid fields to strings in rpc.proto
Use strings instead of byte arrays in 'musigrpc.ContractualTxIds', as it is awkward for the Bisq2 client to reverse the bytes and convert to hex. Returning the raw txid bytes makes things no simpler on either end (even though it is arguably more consistent with the way other SHA256 hashes are represented in most of the protos).
1 parent 1f05b93 commit c185780

3 files changed

Lines changed: 12 additions & 16 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: 5 additions & 5 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 {

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)