closepoolaccount: add more logging

pull/44/head
Oliver Gugger 2 years ago
parent 9601d5893e
commit d67675e68f
No known key found for this signature in database
GPG Key ID: 8E4256593F177720

@ -211,7 +211,7 @@ func closePoolAccount(extendedKey *hdkeychain.ExtendedKey, apiURL string,
return fmt.Errorf("error brute forcing account script: %v", err) 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 := wire.NewMsgTx(2)
sweepTx.LockTime = acct.expiry sweepTx.LockTime = acct.expiry
@ -296,10 +296,19 @@ func closePoolAccount(extendedKey *hdkeychain.ExtendedKey, apiURL string,
type poolAccount struct { type poolAccount struct {
keyIndex uint32 keyIndex uint32
expiry uint32 expiry uint32
sharedKey [32]byte
batchKey []byte
keyTweak []byte keyTweak []byte
witnessScript []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, func bruteForceAccountScript(accountBaseKey *hdkeychain.ExtendedKey,
auctioneerKey *btcec.PublicKey, minExpiry, maxNumBlocks, maxNumAccounts, auctioneerKey *btcec.PublicKey, minExpiry, maxNumBlocks, maxNumAccounts,
maxNumBatchKeys uint32, targetScript []byte) (*poolAccount, error) { maxNumBatchKeys uint32, targetScript []byte) (*poolAccount, error) {
@ -353,9 +362,12 @@ func bruteForceAccountScript(accountBaseKey *hdkeychain.ExtendedKey,
accountPrivKey.PubKey(), accountPrivKey.PubKey(),
) )
batchKey := currentBatchKey.SerializeCompressed()
return &poolAccount{ return &poolAccount{
keyIndex: i, keyIndex: i,
expiry: block, expiry: block,
sharedKey: sharedKey,
batchKey: batchKey,
keyTweak: traderKeyTweak, keyTweak: traderKeyTweak,
witnessScript: witnessScript, witnessScript: witnessScript,
}, nil }, nil

Loading…
Cancel
Save