Skip to content

Commit

Permalink
Fix empty replyTo in update_relay_fee
Browse files Browse the repository at this point in the history
Fixes #1570.
  • Loading branch information
t-bast committed Oct 19, 2020
1 parent 927650d commit 52444b0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -946,8 +946,9 @@ class Channel(val nodeParams: NodeParams, val wallet: EclairWallet, remoteNodeId
case Event(c: CMD_UPDATE_RELAY_FEE, d: DATA_NORMAL) =>
log.info("updating relay fees: prevFeeBaseMsat={} nextFeeBaseMsat={} prevFeeProportionalMillionths={} nextFeeProportionalMillionths={}", d.channelUpdate.feeBaseMsat, c.feeBase, d.channelUpdate.feeProportionalMillionths, c.feeProportionalMillionths)
val channelUpdate = Announcements.makeChannelUpdate(nodeParams.chainHash, nodeParams.privateKey, remoteNodeId, d.shortChannelId, d.channelUpdate.cltvExpiryDelta, d.channelUpdate.htlcMinimumMsat, c.feeBase, c.feeProportionalMillionths, d.commitments.localCommit.spec.totalFunds, enable = Helpers.aboveReserve(d.commitments))
val replyTo = if (c.replyTo == ActorRef.noSender) sender else c.replyTo
replyTo ! RES_SUCCESS(c, d.channelId)
// we use GOTO instead of stay because we want to fire transitions
c.replyTo ! RES_SUCCESS(c, d.channelId)
goto(NORMAL) using d.copy(channelUpdate = channelUpdate) storing()

case Event(BroadcastChannelUpdate(reason), d: DATA_NORMAL) =>
Expand Down Expand Up @@ -1446,8 +1447,9 @@ class Channel(val nodeParams: NodeParams, val wallet: EclairWallet, remoteNodeId
case Event(c: CMD_UPDATE_RELAY_FEE, d: DATA_NORMAL) =>
log.info(s"updating relay fees: prevFeeBaseMsat={} nextFeeBaseMsat={} prevFeeProportionalMillionths={} nextFeeProportionalMillionths={}", d.channelUpdate.feeBaseMsat, c.feeBase, d.channelUpdate.feeProportionalMillionths, c.feeProportionalMillionths)
val channelUpdate = Announcements.makeChannelUpdate(nodeParams.chainHash, nodeParams.privateKey, remoteNodeId, d.shortChannelId, d.channelUpdate.cltvExpiryDelta, d.channelUpdate.htlcMinimumMsat, c.feeBase, c.feeProportionalMillionths, d.commitments.localCommit.spec.totalFunds, enable = false)
val replyTo = if (c.replyTo == ActorRef.noSender) sender else c.replyTo
replyTo ! RES_SUCCESS(c, d.channelId)
// we're in OFFLINE state, we don't broadcast the new update right away, we will do that when next time we go to NORMAL state
c.replyTo ! RES_SUCCESS(c, d.channelId)
stay using d.copy(channelUpdate = channelUpdate) storing()

case Event(getTxResponse: GetTxWithMetaResponse, d: DATA_WAIT_FOR_FUNDING_CONFIRMED) if getTxResponse.txid == d.commitments.commitInput.outPoint.txid => handleGetFundingTx(getTxResponse, d.waitingSince, d.fundingTx)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1733,7 +1733,7 @@ class NormalStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with
val sender = TestProbe()
val newFeeBaseMsat = TestConstants.Alice.nodeParams.feeBase * 2
val newFeeProportionalMillionth = TestConstants.Alice.nodeParams.feeProportionalMillionth * 2
alice ! CMD_UPDATE_RELAY_FEE(sender.ref, newFeeBaseMsat, newFeeProportionalMillionth)
sender.send(alice, CMD_UPDATE_RELAY_FEE(ActorRef.noSender, newFeeBaseMsat, newFeeProportionalMillionth))
sender.expectMsgType[RES_SUCCESS[CMD_UPDATE_RELAY_FEE]]

val localUpdate = channelUpdateListener.expectMsgType[LocalChannelUpdate]
Expand Down

0 comments on commit 52444b0

Please sign in to comment.