Skip to content

Commit d67675e

Browse files
committed
closepoolaccount: add more logging
1 parent 9601d58 commit d67675e

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

cmd/chantools/closepoolaccount.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ func closePoolAccount(extendedKey *hdkeychain.ExtendedKey, apiURL string,
211211
return fmt.Errorf("error brute forcing account script: %v", err)
212212
}
213213

214-
log.Debugf("Found pool account with expiry %d!", acct.expiry)
214+
log.Debugf("Found pool account %s", acct.String())
215215

216216
sweepTx := wire.NewMsgTx(2)
217217
sweepTx.LockTime = acct.expiry
@@ -296,10 +296,19 @@ func closePoolAccount(extendedKey *hdkeychain.ExtendedKey, apiURL string,
296296
type poolAccount struct {
297297
keyIndex uint32
298298
expiry uint32
299+
sharedKey [32]byte
300+
batchKey []byte
299301
keyTweak []byte
300302
witnessScript []byte
301303
}
302304

305+
func (a *poolAccount) String() string {
306+
return fmt.Sprintf("key_index=%d, expiry=%d, shared_key=%x, "+
307+
"batch_key=%x, key_tweak=%x, witness_script=%x",
308+
a.keyIndex, a.expiry, a.sharedKey[:], a.batchKey, a.keyTweak,
309+
a.witnessScript)
310+
}
311+
303312
func bruteForceAccountScript(accountBaseKey *hdkeychain.ExtendedKey,
304313
auctioneerKey *btcec.PublicKey, minExpiry, maxNumBlocks, maxNumAccounts,
305314
maxNumBatchKeys uint32, targetScript []byte) (*poolAccount, error) {
@@ -353,9 +362,12 @@ func bruteForceAccountScript(accountBaseKey *hdkeychain.ExtendedKey,
353362
accountPrivKey.PubKey(),
354363
)
355364

365+
batchKey := currentBatchKey.SerializeCompressed()
356366
return &poolAccount{
357367
keyIndex: i,
358368
expiry: block,
369+
sharedKey: sharedKey,
370+
batchKey: batchKey,
359371
keyTweak: traderKeyTweak,
360372
witnessScript: witnessScript,
361373
}, nil

0 commit comments

Comments
 (0)