Skip to content

Commit

Permalink
fixup! add log for revocation pk and local htlc pk.
Browse files Browse the repository at this point in the history
  • Loading branch information
ziggie1984 committed Jan 16, 2024
1 parent 809ea83 commit 4fe13e9
Showing 1 changed file with 34 additions and 4 deletions.
38 changes: 34 additions & 4 deletions cmd/chantools/sweeptimelockmanual.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 4fe13e9

Please sign in to comment.