From 6d006ac79c2ee93feb348b7e56f126efcd87563f Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Sun, 20 Dec 2015 21:47:57 -0600 Subject: [PATCH] lnwallet: sort inputs/outputs in commit tx --- lnwallet/channel.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lnwallet/channel.go b/lnwallet/channel.go index c0e58960..4d0eb687 100644 --- a/lnwallet/channel.go +++ b/lnwallet/channel.go @@ -210,6 +210,10 @@ func createCommitTx(fundingOutput *wire.TxIn, ourKey, theirKey *btcec.PublicKey, commitTx.AddTxOut(wire.NewTxOut(int64(amtToUs), payToUsScriptHash)) commitTx.AddTxOut(wire.NewTxOut(int64(amtToThem), payToThemScriptHash)) + // Sort the transaction according to the agreed upon cannonical + // ordering. This lets us skip sending the entire transaction over, + // instead we'll just send signatures. + txsort.InPlaceSort(commitTx) return commitTx, nil }