Skip to content

Commit 323a5ab

Browse files
authored
Merge pull request #37 from buffrr/revoke-badsig
Fix revoke state for `bid_psbt_bad_signature` events
2 parents 624dcf9 + fd143a7 commit 323a5ab

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

Diff for: protocol/src/validate.rs

+9-4
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ impl Validator {
479479
) {
480480
let input = tx.input.get(input_index as usize).expect("input");
481481
let mut spaceout = stxo.previous_output;
482-
let space_ref = spaceout.space.as_mut().unwrap();
482+
let space_ref = spaceout.space.as_ref().unwrap();
483483
// Handle bid spends
484484
if space_ref.is_bid_spend(tx.version, input) {
485485
// Bid spends must have an auctioned output
@@ -526,7 +526,7 @@ impl Validator {
526526
None
527527
};
528528

529-
space_ref.covenant = Covenant::Bid {
529+
let new_covenant = Covenant::Bid {
530530
signature: auctioned_output.bid_psbt.signature,
531531
total_burned: total_burned + auctioned_output.bid_psbt.burn_amount,
532532
burn_increment: auctioned_output.bid_psbt.burn_amount,
@@ -542,11 +542,16 @@ impl Validator {
542542
txid: auctioned_output.bid_psbt.outpoint.txid,
543543
spaceout: auctioned_spaceout,
544544
};
545-
fullspaceout.spaceout.space = Some(spaceout.space.unwrap());
545+
let mut updated_space = spaceout.space.clone().unwrap();
546+
updated_space.covenant = new_covenant;
547+
fullspaceout.spaceout.space = Some(updated_space);
546548

547549
if !fullspaceout.verify_bid_sig() {
548550
changeset.updates.push(UpdateOut {
549-
output: fullspaceout,
551+
output: FullSpaceOut {
552+
txid: input.previous_output.txid,
553+
spaceout,
554+
},
550555
kind: UpdateKind::Revoke(RevokeReason::BidPsbt(BidPsbtReason::BadSignature)),
551556
});
552557
return;

0 commit comments

Comments
 (0)