lnwallet: only the initiator needs to validate new fee updates
In this commit, we fix an existing bug, as only the initiator needs to validate any new fee updates. If the initiator sends an invalid fee, then it will be rejected by the responder as it may put them below their required reserve.
This commit is contained in:
parent
3e90000e2a
commit
483dc3f96a
@ -1695,7 +1695,7 @@ func (lc *LightningChannel) restoreStateLogs(
|
||||
}
|
||||
|
||||
// HtlcRetribution contains all the items necessary to seep a revoked HTLC
|
||||
// transaction from a revoked commitment transaction broadcast by the remot
|
||||
// transaction from a revoked commitment transaction broadcast by the remote
|
||||
// party.
|
||||
type HtlcRetribution struct {
|
||||
// SignDesc is a design descriptor capable of generating the necessary
|
||||
@ -4937,10 +4937,7 @@ func (lc *LightningChannel) ReceiveUpdateFee(feePerKw btcutil.Amount) error {
|
||||
return fmt.Errorf("received fee update as initiator")
|
||||
}
|
||||
|
||||
// Ensure that the passed fee rate meets our current requirements.
|
||||
if err := lc.validateFeeRate(feePerKw); err != nil {
|
||||
return err
|
||||
}
|
||||
// TODO(roasbeef): or just modify to use the other balance?
|
||||
|
||||
lc.pendingFeeUpdate = &feePerKw
|
||||
|
||||
|
@ -3385,7 +3385,7 @@ func TestFeeUpdateRejectInsaneFee(t *testing.T) {
|
||||
// Create a test channel which will be used for the duration of this
|
||||
// unittest. The channel will be funded evenly with Alice having 5 BTC,
|
||||
// and Bob having 5 BTC.
|
||||
aliceChannel, bobChannel, cleanUp, err := createTestChannels(1)
|
||||
aliceChannel, _, cleanUp, err := createTestChannels(1)
|
||||
if err != nil {
|
||||
t.Fatalf("unable to create test channels: %v", err)
|
||||
}
|
||||
@ -3401,9 +3401,6 @@ func TestFeeUpdateRejectInsaneFee(t *testing.T) {
|
||||
if err := aliceChannel.UpdateFee(newFeeRate); err == nil {
|
||||
t.Fatalf("alice should've rejected fee update")
|
||||
}
|
||||
if err := bobChannel.ReceiveUpdateFee(newFeeRate); err == nil {
|
||||
t.Fatalf("bob should've rejected fee update")
|
||||
}
|
||||
}
|
||||
|
||||
// TestChannelRetransmissionFeeUpdate tests that the initiator will include any
|
||||
|
Loading…
Reference in New Issue
Block a user