mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-02-22 14:22:37 +01:00
routing/localchans: fix nested db tx
This commit fixes a bug where a db tx is opened within another db tx.
This commit is contained in:
parent
3f775778c3
commit
bd07b5f49e
2 changed files with 7 additions and 5 deletions
|
@ -148,6 +148,8 @@ you.
|
|||
* [Fixed context leak in integration tests, and properly handled context
|
||||
timeout](https://github.com/lightningnetwork/lnd/pull/5646).
|
||||
|
||||
* [Removed nested db tx](https://github.com/lightningnetwork/lnd/pull/5643)
|
||||
|
||||
## Database
|
||||
|
||||
* [Ensure single writer for legacy
|
||||
|
|
|
@ -81,7 +81,7 @@ func (r *Manager) UpdatePolicy(newSchema routing.ChannelPolicy,
|
|||
}
|
||||
|
||||
// Apply the new policy to the edge.
|
||||
err := r.updateEdge(info.ChannelPoint, edge, newSchema)
|
||||
err := r.updateEdge(tx, info.ChannelPoint, edge, newSchema)
|
||||
if err != nil {
|
||||
log.Warnf("Cannot update policy for %v: %v\n",
|
||||
info.ChannelPoint, err,
|
||||
|
@ -127,7 +127,7 @@ func (r *Manager) UpdatePolicy(newSchema routing.ChannelPolicy,
|
|||
}
|
||||
|
||||
// updateEdge updates the given edge with the new schema.
|
||||
func (r *Manager) updateEdge(chanPoint wire.OutPoint,
|
||||
func (r *Manager) updateEdge(tx kvdb.RTx, chanPoint wire.OutPoint,
|
||||
edge *channeldb.ChannelEdgePolicy,
|
||||
newSchema routing.ChannelPolicy) error {
|
||||
|
||||
|
@ -139,7 +139,7 @@ func (r *Manager) updateEdge(chanPoint wire.OutPoint,
|
|||
edge.TimeLockDelta = uint16(newSchema.TimeLockDelta)
|
||||
|
||||
// Retrieve negotiated channel htlc amt limits.
|
||||
amtMin, amtMax, err := r.getHtlcAmtLimits(chanPoint)
|
||||
amtMin, amtMax, err := r.getHtlcAmtLimits(tx, chanPoint)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
@ -198,10 +198,10 @@ func (r *Manager) updateEdge(chanPoint wire.OutPoint,
|
|||
|
||||
// getHtlcAmtLimits retrieves the negotiated channel min and max htlc amount
|
||||
// constraints.
|
||||
func (r *Manager) getHtlcAmtLimits(chanPoint wire.OutPoint) (
|
||||
func (r *Manager) getHtlcAmtLimits(tx kvdb.RTx, chanPoint wire.OutPoint) (
|
||||
lnwire.MilliSatoshi, lnwire.MilliSatoshi, error) {
|
||||
|
||||
ch, err := r.FetchChannel(nil, chanPoint)
|
||||
ch, err := r.FetchChannel(tx, chanPoint)
|
||||
if err != nil {
|
||||
return 0, 0, err
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue