mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-12-04 18:01:57 +01:00
multi: remove function BalancesAtHeight
This commit deletes the function `BalancesAtHeight` since its only usague is to find the push amount, which can be achieved by saving the initial balances. Another reason to remove it is to pave the way to incooperate our new revocation log. If we ever need this function again, we can add it back by visiting all the revocation logs to calculate the balances at a given height.
This commit is contained in:
12
rpcserver.go
12
rpcserver.go
@@ -4080,21 +4080,13 @@ func createRPCOpenChannel(r *rpcServer, dbChannel *channeldb.OpenChannel,
|
||||
channel.UnsettledBalance += channel.PendingHtlcs[i].Amount
|
||||
}
|
||||
|
||||
// Lookup our balances at height 0, because they will reflect any
|
||||
// push amounts that may have been present when this channel was
|
||||
// created.
|
||||
localBalance, remoteBalance, err := dbChannel.BalancesAtHeight(0)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// If we initiated opening the channel, the zero height remote balance
|
||||
// is the push amount. Otherwise, our starting balance is the push
|
||||
// amount. If there is no push amount, these values will simply be zero.
|
||||
if dbChannel.IsInitiator {
|
||||
channel.PushAmountSat = uint64(remoteBalance.ToSatoshis())
|
||||
channel.PushAmountSat = uint64(dbChannel.InitialRemoteBalance)
|
||||
} else {
|
||||
channel.PushAmountSat = uint64(localBalance.ToSatoshis())
|
||||
channel.PushAmountSat = uint64(dbChannel.InitialLocalBalance)
|
||||
}
|
||||
|
||||
if len(dbChannel.LocalShutdownScript) > 0 {
|
||||
|
||||
Reference in New Issue
Block a user