Skip to content

Commit ecf9a8f

Browse files
committed
fix comments
1 parent 2f2522f commit ecf9a8f

3 files changed

Lines changed: 14 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ The format is loosely based on [Keep a Changelog](https://keepachangelog.com/en/
2222
- `wallet-create`/`wallet-recover`/`wallet-open` support the `ledger` subcommand, in addition to the existing
2323
`software` and `trezor`, which specifies the type of the wallet to operate on.
2424

25+
### Fixed
26+
- Wallet:
27+
- Fixed handling of confirmed and unconfirmed conflicting order transactions in the wallet.
28+
2529
## [1.3.0] - 2026-04-09
2630

2731
### Added

wallet/src/account/output_cache/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2103,8 +2103,8 @@ fn uses_conflicting_nonce(
21032103

21042104
fn uses_conflicting_order_command(
21052105
unconfirmed_tx: &WalletTx,
2106-
cmd_tag: OrderAccountCommandTag,
2107-
order_id: OrderId,
2106+
confirmed_cmd_tag: OrderAccountCommandTag,
2107+
confirmed_order_id: OrderId,
21082108
) -> bool {
21092109
unconfirmed_tx.inputs().iter().any(|input| match input {
21102110
TxInput::OrderAccountCommand(cmd) => {
@@ -2114,12 +2114,12 @@ fn uses_conflicting_order_command(
21142114
| OrderAccountCommand::ConcludeOrder(id) => *id,
21152115
};
21162116
// It is only a conflict if it is the same order id
2117-
if unconfirmed_order_id != order_id {
2117+
if unconfirmed_order_id != confirmed_order_id {
21182118
return false;
21192119
}
21202120

21212121
let unconfirmed_cmd_tag: OrderAccountCommandTag = cmd.into();
2122-
match cmd_tag {
2122+
match confirmed_cmd_tag {
21232123
// Confirmed fill orders do not conflict with anything
21242124
OrderAccountCommandTag::FillOrder => false,
21252125
// Confirmed conclude order conflict with any other unconfirmed operation on the

wallet/src/account/output_cache/tests.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1379,7 +1379,7 @@ fn update_conflicting_txs_order_v1_conclude(#[case] seed: Seed) {
13791379
assert!(output_cache.orders[&order_id].is_concluded);
13801380

13811381
// A *different* confirmed conclude tx for the same order arrives.
1382-
// update_conflicting_txs must mark the unconfirmed one as Conflicted.
1382+
// update_conflicting_txs must mark the unconfirmed ones as Conflicted.
13831383
let confirmed_conclude_tx = TransactionBuilder::new()
13841384
.add_input(
13851385
TxInput::OrderAccountCommand(OrderAccountCommand::ConcludeOrder(order_id)),
@@ -1446,6 +1446,7 @@ fn update_conflicting_txs_order_v1_conclude(#[case] seed: Seed) {
14461446
.unwrap();
14471447

14481448
assert!(output_cache.orders[&order_id].is_concluded);
1449+
assert!(!output_cache.orders[&order_id].is_frozen);
14491450
}
14501451

14511452
// Regression test: same as above but for FreezeOrder.
@@ -1531,6 +1532,8 @@ fn update_conflicting_txs_order_v1_freeze(#[case] seed: Seed) {
15311532
.unwrap();
15321533

15331534
assert!(output_cache.orders[&order_id].is_frozen);
1535+
// concluded is still false
1536+
assert!(!output_cache.orders[&order_id].is_concluded);
15341537

15351538
// A *different* confirmed freeze tx for the same order arrives.
15361539
// update_conflicting_txs must mark the unconfirmed one as Conflicted.
@@ -1577,6 +1580,7 @@ fn update_conflicting_txs_order_v1_freeze(#[case] seed: Seed) {
15771580

15781581
// is_frozen must be rolled back after the conflict.
15791582
assert!(!output_cache.orders[&order_id].is_frozen);
1583+
assert!(!output_cache.orders[&order_id].is_concluded);
15801584

15811585
// The confirmed freeze tx must now be addable without error.
15821586
output_cache
@@ -1592,6 +1596,7 @@ fn update_conflicting_txs_order_v1_freeze(#[case] seed: Seed) {
15921596
.unwrap();
15931597

15941598
assert!(output_cache.orders[&order_id].is_frozen);
1599+
assert!(!output_cache.orders[&order_id].is_concluded);
15951600
}
15961601

15971602
fn add_random_transfer_tx(

0 commit comments

Comments
 (0)