From 1e67040145eac82ccd3f03cedb4930161dd65139 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Mon, 30 Sep 2019 19:50:31 -0700 Subject: [PATCH] lnwallet: copy commitment transaction in getSignedCommitTx In this commit, we move to make a full deep copy of the commitment transaction in `getSignedCommitTx` to ensure that we don't mutate the commitment on disk, possibly resulting in a "hot commitment". --- lnwallet/channel.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lnwallet/channel.go b/lnwallet/channel.go index 720f5d0d..b29d79d4 100644 --- a/lnwallet/channel.go +++ b/lnwallet/channel.go @@ -4946,7 +4946,7 @@ func (lc *LightningChannel) getSignedCommitTx() (*wire.MsgTx, error) { // Fetch the current commitment transaction, along with their signature // for the transaction. localCommit := lc.channelState.LocalCommitment - commitTx := localCommit.CommitTx + commitTx := localCommit.CommitTx.Copy() theirSig := append(localCommit.CommitSig, byte(txscript.SigHashAll)) // With this, we then generate the full witness so the caller can