From d67675e68f2c18ad4df9d986e1cb935f1461ed59 Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Wed, 2 Feb 2022 11:47:24 +0100 Subject: [PATCH] closepoolaccount: add more logging --- cmd/chantools/closepoolaccount.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/cmd/chantools/closepoolaccount.go b/cmd/chantools/closepoolaccount.go index 23bc48c..35d2964 100644 --- a/cmd/chantools/closepoolaccount.go +++ b/cmd/chantools/closepoolaccount.go @@ -211,7 +211,7 @@ func closePoolAccount(extendedKey *hdkeychain.ExtendedKey, apiURL string, return fmt.Errorf("error brute forcing account script: %v", err) } - log.Debugf("Found pool account with expiry %d!", acct.expiry) + log.Debugf("Found pool account %s", acct.String()) sweepTx := wire.NewMsgTx(2) sweepTx.LockTime = acct.expiry @@ -296,10 +296,19 @@ func closePoolAccount(extendedKey *hdkeychain.ExtendedKey, apiURL string, type poolAccount struct { keyIndex uint32 expiry uint32 + sharedKey [32]byte + batchKey []byte keyTweak []byte witnessScript []byte } +func (a *poolAccount) String() string { + return fmt.Sprintf("key_index=%d, expiry=%d, shared_key=%x, "+ + "batch_key=%x, key_tweak=%x, witness_script=%x", + a.keyIndex, a.expiry, a.sharedKey[:], a.batchKey, a.keyTweak, + a.witnessScript) +} + func bruteForceAccountScript(accountBaseKey *hdkeychain.ExtendedKey, auctioneerKey *btcec.PublicKey, minExpiry, maxNumBlocks, maxNumAccounts, maxNumBatchKeys uint32, targetScript []byte) (*poolAccount, error) { @@ -353,9 +362,12 @@ func bruteForceAccountScript(accountBaseKey *hdkeychain.ExtendedKey, accountPrivKey.PubKey(), ) + batchKey := currentBatchKey.SerializeCompressed() return &poolAccount{ keyIndex: i, expiry: block, + sharedKey: sharedKey, + batchKey: batchKey, keyTweak: traderKeyTweak, witnessScript: witnessScript, }, nil