Skip to content

Commit 647a464

Browse files
committed
merge main
2 parents 2518ab9 + ba5b2ff commit 647a464

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

protocol/src/lib.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,40 +115,49 @@ pub enum Covenant {
115115
#[derive(Copy, Clone, PartialEq, Debug)]
116116
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
117117
#[cfg_attr(feature = "bincode", derive(Encode, Decode))]
118-
#[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))]
118+
#[cfg_attr(
119+
feature = "serde",
120+
serde(rename_all = "snake_case", tag = "reason")
121+
)]
119122
pub enum RevokeReason {
120-
BidPsbt(BidPsbtReason),
121123
/// Space was prematurely spent during the auctions phase
122124
PrematureClaim,
123125
/// Space output was spent either by spending it directly
124126
/// Space was transferred without following Input N => Output N+1 rule
125127
BadSpend,
126128
Expired,
129+
#[cfg_attr(feature = "serde", serde(untagged))]
130+
BidPsbt(BidPsbtReason)
127131
}
128132

129133
#[derive(Copy, Clone, PartialEq, Debug, Eq)]
130134
#[cfg_attr(
131135
feature = "serde",
132136
derive(Serialize, Deserialize),
133-
serde(rename_all = "snake_case")
137+
serde(rename_all = "snake_case", tag="reason")
134138
)]
135139
#[cfg_attr(feature = "bincode", derive(Encode, Decode))]
136140
pub enum RejectReason {
137141
AlreadyExists,
142+
#[cfg_attr(feature = "serde", serde(untagged))]
138143
BidPsbt(BidPsbtReason),
139144
}
140145

141146
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
142147
#[cfg_attr(
143148
feature = "serde",
144149
derive(Serialize, Deserialize),
145-
serde(rename_all = "snake_case")
150+
serde(tag = "reason")
146151
)]
147152
#[cfg_attr(feature = "bincode", derive(Encode, Decode))]
148153
pub enum BidPsbtReason {
154+
#[cfg_attr(feature = "serde", serde(rename = "bid_psbt_required"))]
149155
Required,
156+
#[cfg_attr(feature = "serde", serde(rename = "bid_psbt_low_bid_amount"))]
150157
LowBidAmount,
158+
#[cfg_attr(feature = "serde", serde(rename = "bid_psbt_bad_signature"))]
151159
BadSignature,
160+
#[cfg_attr(feature = "serde", serde(rename = "bid_psbt_output_spent"))]
152161
OutputSpent,
153162
}
154163

protocol/src/validate.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ pub struct RevokeParams {
8282
pub struct RejectParams {
8383
#[cfg_attr(feature = "bincode", bincode(with_serde))]
8484
pub name: SName,
85+
86+
#[cfg_attr(feature = "serde", serde(flatten))]
8587
pub reason: RejectReason,
8688
}
8789

0 commit comments

Comments
 (0)