Skip to content

[Contracts] Remove duplicate if stream.paused guard in withdraw() #534

@ogazboiz

Description

@ogazboiz

Telegram: https://t.me/+DOylgFv1jyJlNzM0

Why this matters

StreamContract::withdraw in contracts/stream_contract/src/lib.rs checks the same condition twice in a row:

Self::validate_stream_active(&stream)?;
if stream.paused {
    return Err(StreamError::StreamInactive);
}
if stream.paused {
    return Err(StreamError::StreamInactive);
}

The second if stream.paused block (lines ~436-438) is dead, unreachable duplicate code. It does no harm functionally but is confusing and slightly bloats the compiled WASM. Removing it improves readability.

Acceptance criteria

  • Delete the redundant second if stream.paused { return Err(StreamError::StreamInactive); } block in withdraw
  • cargo test still passes (existing paused-withdraw tests cover this path)
  • cargo build --target wasm32-unknown-unknown --release succeeds

Files to touch

  • contracts/stream_contract/src/lib.rs (the withdraw function, ~lines 431-438)

Out of scope

  • Any change to pause/withdraw semantics — this is a pure dead-code removal.

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programcontractsSmart contract related tasksgood first issueGood for newcomersrefactorRefactoring existing code

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions