Skip to content

Commit

Permalink
bdkwallet: reverse hashes
Browse files Browse the repository at this point in the history
Since everyone reverses the hashes, we also need to reverse them so it
looks right.
  • Loading branch information
kcalvinalvin committed Feb 1, 2024
1 parent 779ca92 commit 3a96310
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions bdkwallet/bdkwallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import "C"

import (
"bytes"
"encoding/hex"

"github.com/utreexo/utreexod/bdkwallet/bdkgo"
"github.com/utreexo/utreexod/btcutil"
"github.com/utreexo/utreexod/chaincfg"
"github.com/utreexo/utreexod/chaincfg/chainhash"
"github.com/utreexo/utreexod/mempool"
"github.com/utreexo/utreexod/wire"
)
Expand Down Expand Up @@ -145,9 +145,14 @@ func (w *BDKWallet) ApplyBlock(block *btcutil.Block) error {
if err != nil {
return err
}

for _, txid := range res.RelevantTxids {
hash, err := chainhash.NewHash(txid)
if err != nil {
return err
}
log.Infof("Found relevant tx %v in block %v:%v.",
hex.EncodeToString(txid), bheight, block.Hash().String())
hash.String(), bheight, block.Hash().String())
}
return nil
}
Expand All @@ -173,7 +178,11 @@ func (w *BDKWallet) ApplyMempoolTransactions(txns []*mempool.TxDesc) error {
return err
}
for _, txid := range res.RelevantTxids {
log.Infof("Found relevant tx %v in mempool.", hex.EncodeToString(txid))
hash, err := chainhash.NewHash(txid)
if err != nil {
return err
}
log.Infof("Found relevant tx %v in mempool.", hash.String())
}
return nil
}
Expand Down

0 comments on commit 3a96310

Please sign in to comment.