Skip to content
This repository has been archived by the owner on Nov 2, 2018. It is now read-only.

Commit

Permalink
fix segfault
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisSchinnerl committed Jan 8, 2018
1 parent eb74a8f commit b5bc341
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions modules/wallet/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,9 @@ func dbDeleteBroadcastedTSet(tx *bolt.Tx, tSetID modules.TransactionSetID) error
}

// dbLoadBroadcastedTSets returns all the broadcasted tSets from the database
func dbLoadBroadcastedTSets(tx *bolt.Tx) (tSets map[modules.TransactionSetID]*broadcastedTSet, err error) {
func dbLoadBroadcastedTSets(w *Wallet) (tSets map[modules.TransactionSetID]*broadcastedTSet, err error) {
tSets = make(map[modules.TransactionSetID]*broadcastedTSet)
err = tx.Bucket(bucketBroadcastedTSets).ForEach(func(k []byte, v []byte) error {
err = w.dbTx.Bucket(bucketBroadcastedTSets).ForEach(func(k []byte, v []byte) error {
// Load the persisted structure from disk
var pbts persistBTS
if err := encoding.Unmarshal(v, &pbts); err != nil {
Expand All @@ -261,6 +261,7 @@ func dbLoadBroadcastedTSets(tx *bolt.Tx) (tSets map[modules.TransactionSetID]*br
}

bts.id = modules.TransactionSetID(crypto.HashAll(bts.transactions))
bts.w = w
tSets[bts.id] = &bts
return nil
})
Expand Down
2 changes: 1 addition & 1 deletion modules/wallet/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func newWallet(cs modules.ConsensusSet, tpool modules.TransactionPool, persistDi
}

// retrieve the previously tracked broadcasted tSets from the database
w.broadcastedTSets, err = dbLoadBroadcastedTSets(w.dbTx)
w.broadcastedTSets, err = dbLoadBroadcastedTSets(w)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit b5bc341

Please sign in to comment.