diff --git a/lnwallet/channel.go b/lnwallet/channel.go index 57d25179..b3ef0dd9 100644 --- a/lnwallet/channel.go +++ b/lnwallet/channel.go @@ -622,8 +622,6 @@ type LightningChannel struct { // able to broadcast safely. localCommitChain *commitmentChain - // stateMtx protects concurrent access to the state struct. - stateMtx sync.RWMutex channelState *channeldb.OpenChannel // [local|remote]Log is a (mostly) append-only log storing all the HTLC @@ -2738,8 +2736,8 @@ func (lc *LightningChannel) DeleteState(c *channeldb.ChannelCloseSummary) error // StateSnapshot returns a snapshot of the current fully committed state within // the channel. func (lc *LightningChannel) StateSnapshot() *channeldb.ChannelSnapshot { - lc.stateMtx.RLock() - defer lc.stateMtx.RUnlock() + lc.RLock() + defer lc.RUnlock() return lc.channelState.Snapshot() } diff --git a/lnwallet/wallet.go b/lnwallet/wallet.go index 837c8b59..8de8204a 100644 --- a/lnwallet/wallet.go +++ b/lnwallet/wallet.go @@ -1453,7 +1453,7 @@ func coinSelect(feeRate uint64, amt btcutil.Amount, estimatedSize = ((len(selectedUtxos) * p2wkhSpendSize) + p2wshOutputSize + txOverhead) - // The difference bteween the selected amount and the amount + // The difference between the selected amount and the amount // requested will be used to pay fees, and generate a change // output with the remaining. overShootAmt := totalSat - amtNeeded @@ -1468,7 +1468,8 @@ func coinSelect(feeRate uint64, amt btcutil.Amount, continue } - // If the fee is sufficient, then calculate the size of the change output. + // If the fee is sufficient, then calculate the size of the + // change output. changeAmt := overShootAmt - requiredFee return selectedUtxos, changeAmt, nil