Skip to content

Commit b35e6e0

Browse files
committed
multi: add trace log outputs
This commit adds a couple of trace outputs that were helpful in finding two bugs fixed in this series of commits. We also increase the number of levels the spew logger is allowed to print, so we can see a bit more. We need this limit to avoid endless loops in self-referencing structs such as proofs.
1 parent 86fb985 commit b35e6e0

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

tapchannel/commitment.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,13 @@ func CreateAllocations(chanState lnwallet.AuxChanState, ourBalance,
763763
// asset level, NOT for the BTC level.
764764
tweakedTree := TweakHtlcTree(htlcTree, htlc.HtlcIndex)
765765

766+
log.Tracef("Tweaking HTLC script key with index %d: internal "+
767+
"key %x -> %x, script key %x -> %x", htlc.HtlcIndex,
768+
htlcTree.InternalKey.SerializeCompressed(),
769+
tweakedTree.InternalKey.SerializeCompressed(),
770+
schnorr.SerializePubKey(htlcTree.TaprootKey),
771+
schnorr.SerializePubKey(tweakedTree.TaprootKey))
772+
766773
allocations = append(allocations, &Allocation{
767774
Type: allocType,
768775
Amount: rfqmsg.Sum(htlc.AssetBalances),
@@ -1288,6 +1295,13 @@ func createSecondLevelHtlcAllocations(chanType channeldb.ChannelType,
12881295
// the BTC level.
12891296
tweakedTree := TweakHtlcTree(htlcTree, htlcIndex)
12901297

1298+
log.Tracef("Tweaking second level HTLC script key with index %d: "+
1299+
"internal key %x -> %x, script key %x -> %x", htlcIndex,
1300+
htlcTree.InternalKey.SerializeCompressed(),
1301+
tweakedTree.InternalKey.SerializeCompressed(),
1302+
schnorr.SerializePubKey(htlcTree.TaprootKey),
1303+
schnorr.SerializePubKey(tweakedTree.TaprootKey))
1304+
12911305
allocations := []*Allocation{{
12921306
Type: SecondLevelHtlcAllocation,
12931307
// If we're making the second-level transaction just to sign,

tapchannel/log.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var log = btclog.Disabled
1717
// to 4 levels, so it can safely be used for things that contain an MS-SMT tree.
1818
var limitSpewer = &spew.ConfigState{
1919
Indent: " ",
20-
MaxDepth: 5,
20+
MaxDepth: 7,
2121
}
2222

2323
// DisableLog disables all library log output. Logging output is disabled

tapsend/send.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"github.com/btcsuite/btcd/txscript"
2020
"github.com/btcsuite/btcd/wire"
2121
"github.com/btcsuite/btclog"
22+
"github.com/davecgh/go-spew/spew"
2223
"github.com/lightninglabs/lndclient"
2324
"github.com/lightninglabs/taproot-assets/address"
2425
"github.com/lightninglabs/taproot-assets/asset"
@@ -974,6 +975,9 @@ func CreateTaprootSignature(vIn *tappsbt.VInput, virtualTx *wire.MsgTx,
974975
"from virtual transaction packet")
975976
}
976977

978+
log.Tracef("Signing virtual TX with descriptor %v",
979+
spew.Sdump(spendDesc))
980+
977981
sig, err := txSigner.SignVirtualTx(&spendDesc, virtualTx, prevOut)
978982
if err != nil {
979983
return nil, err

0 commit comments

Comments
 (0)