Skip to content

Commit

Permalink
SpendableBalance: enable when funding not locked
Browse files Browse the repository at this point in the history
When SpendableBalance is called when the funding is not yet locked,
report the full channel balance rather than crashing.
  • Loading branch information
canndrew committed Jun 17, 2021
1 parent bdbd7f0 commit f817da9
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/DotNetLightning.Core/Channel/Channel.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1168,9 +1168,7 @@ and Channel = {
let remoteCommit =
match remoteNextCommitInfo with
| Some (RemoteNextCommitInfo.Waiting nextRemoteCommit) -> nextRemoteCommit
| Some (RemoteNextCommitInfo.Revoked _info) -> savedChannelState.RemoteCommit
// TODO: This could return a proper error, or report the full balance
| None -> failwith "funding is not locked"
| _ -> savedChannelState.RemoteCommit
let reducedRes =
remoteCommit.Spec.Reduce(
savedChannelState.RemoteChanges.ACKed,
Expand Down

0 comments on commit f817da9

Please sign in to comment.