From 4fe13e9b2ef9dc1927b35dfdf2f0dbe5e01a39ee Mon Sep 17 00:00:00 2001 From: ziggie Date: Mon, 15 Jan 2024 16:08:25 +0100 Subject: [PATCH] fixup! add log for revocation pk and local htlc pk. --- cmd/chantools/sweeptimelockmanual.go | 38 +++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/cmd/chantools/sweeptimelockmanual.go b/cmd/chantools/sweeptimelockmanual.go index 17d2786..969f08c 100644 --- a/cmd/chantools/sweeptimelockmanual.go +++ b/cmd/chantools/sweeptimelockmanual.go @@ -156,6 +156,25 @@ chantools sweeptimelockmanual \ } func (c *sweepTimeLockManualCommand) Execute(_ *cobra.Command, _ []string) error { + + // delayedBase, _ := pubKeyFromHex("035b4fd46f5f985500cf3343ddf1205dc3da4a4fae988f53aee93731bbb3ec4e9f") + // commitPoint, _ := pubKeyFromHex("0232f0db3924b7fc231656a7c8a192b405cae86bf3380c15f5145c26069433836f") + // revBase, _ := pubKeyFromHex("02c9b095733fef24ab67888d95fcfa1dd1deb79312b34db2d59a01c65c32ff8f29") + + // root := &hdkeychain.ExtendedKey{} + + // lockScript, err := lnd.PrepareWalletAddress( + // c.TimeLockAddr, chainParams, nil, root, "time lock", + // ) + + // _, _, _, err = bruteForceDelay( + // input.TweakPubKey(delayedBase, commitPoint), + // input.DeriveRevocationPubkey(revBase, commitPoint), + // lockScript, 600, 600, + // ) + + // fmt.Println("DONEDONE") + extendedKey, err := c.rootKey.read() if err != nil { return fmt.Errorf("error reading root key: %w", err) @@ -587,6 +606,11 @@ func tryKey(baseKey *hdkeychain.ExtendedKey, remoteRevPoint *btcec.PublicKey, return 0, nil, nil, nil, nil, err } + log.Infof("MultiSigBase: %x", + multiSigPrivKey.PubKey().SerializeCompressed()) + + log.Infof("ShaRootPath: %v", revPath3) + csvTimeout, script, scriptHash, commitPoint, err = bruteForceDelayPoint( delayPrivKey.PubKey(), remoteRevPoint, htlcPrivKey.PubKey(), revRoot3, lockScript, startCsvTimeout, maxCsvTimeout, startNumChanUpdates, @@ -621,13 +645,19 @@ func bruteForceDelayPoint(delayBase, revBase, htlcBase *btcec.PublicKey, } commitPoint := input.ComputeCommitmentPoint(revPreimage[:]) - log.Infof("RevocationPK(RIPEMD160): %v", + log.Infof("RevocationPK(RIPEMD160): %x", btcutil.Hash160(input.DeriveRevocationPubkey(revBase, commitPoint).SerializeCompressed())) - log.Infof("LocalHTLCPK: %v", - btcutil.Hash160(input.TweakPubKey(htlcBase, commitPoint).SerializeCompressed())) + log.Infof("LocalHTLCPK: %x", + input.TweakPubKey(htlcBase, commitPoint).SerializeCompressed()) + + log.Infof("DelayedBase: %x", + delayBase.SerializeCompressed()) + + log.Infof("HTLCBase: %x", + htlcBase.SerializeCompressed()) - log.Infof("CommitPoint at ChanUpdate#%v", i) + log.Infof("CommitPoint at ChanUpdate#%v, CPoint=%x", i, commitPoint.SerializeCompressed()) csvTimeout, script, scriptHash, err := bruteForceDelay( input.TweakPubKey(delayBase, commitPoint),