Skip to content

Commit 830343f

Browse files
authored
Merge pull request #100 from TheBlueMatt/2018-07-htlc-balance-calc
Fix non-HTLC-inclusion balance calculation (mark II)
2 parents f975639 + b17211f commit 830343f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/ln/channel.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ enum HTLCState {
136136
/// anyway).
137137
LocalRemoved,
138138
/// Removed by us, sent a new commitment_signed and got a revoke_and_ack. Just waiting on an
139-
/// updated local commitment transaction.
139+
/// updated local commitment transaction. Implies local_removed_fulfilled.
140140
LocalRemovedAwaitingCommitment,
141141
}
142142

@@ -663,7 +663,7 @@ impl Channel {
663663
} else {
664664
match htlc.state {
665665
HTLCState::AwaitingRemoteRevokeToRemove|HTLCState::AwaitingRemovedRemoteRevoke => {
666-
if generated_by_local && htlc.fail_reason.is_none() {
666+
if htlc.fail_reason.is_none() {
667667
value_to_self_msat_offset -= htlc.amount_msat as i64;
668668
}
669669
},
@@ -678,6 +678,7 @@ impl Channel {
678678
}
679679
},
680680
HTLCState::LocalRemovedAwaitingCommitment => {
681+
assert!(htlc.local_removed_fulfilled);
681682
value_to_self_msat_offset += htlc.amount_msat as i64;
682683
},
683684
_ => {},

0 commit comments

Comments
 (0)