Skip to content

Commit

Permalink
fix: fix address lookahead
Browse files Browse the repository at this point in the history
  • Loading branch information
tyzbit committed Apr 27, 2022
1 parent 36eacd0 commit 003a3cd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,21 +235,22 @@ func (w WatcherConfig) WatchPubkey(c btcapi.Config, nickPubkey string) {
if err != nil {
log.Errorf("error calling btcapi: %v", err)
}
pubkeyTxCount := 0
for _, address := range pubKeyPage.ReceiveAddresses {
previousTxCount := totalPubkeyTxCount
addressSummary, err := c.AddressSummary(address)
if err != nil {
log.Errorf("error calling btcapi: %v", err)
continue
}
totalPubkeyBalance = totalPubkeyBalance + addressSummary.TXHistory.BalanceSat
totalPubkeyTxCount = totalPubkeyTxCount + addressSummary.TXHistory.TXCount
if previousTxCount == totalPubkeyTxCount {
if pubkeyTxCount == addressSummary.TXHistory.TXCount {
if NoTXCount > w.Lookahead {
break pubkey
}
NoTXCount++
}
pubkeyTxCount = addressSummary.TXHistory.TXCount
}
}
totalBalance = totalBalance + totalPubkeyBalance
Expand Down

0 comments on commit 003a3cd

Please sign in to comment.