Skip to content

Commit

Permalink
Fixed UTXO indexer and organized index by address and block height
Browse files Browse the repository at this point in the history
Bugfix: Make indexer reorg look exactly like SetCurrentHeader
  • Loading branch information
jdowning100 committed Oct 25, 2024
1 parent f9a2078 commit e0216d9
Show file tree
Hide file tree
Showing 20 changed files with 715 additions and 1,399 deletions.
136 changes: 25 additions & 111 deletions common/proto_common.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion consensus/blake3pow/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ func (blake3pow *Blake3pow) Finalize(chain consensus.ChainHeaderReader, batch et
continue
}
}
addressOutpointMap := make(map[string]map[string]*types.OutpointAndDenomination)
addressOutpointMap := make(map[[20]byte][]*types.OutpointAndDenomination)
core.AddGenesisUtxos(chain.Database(), &utxosCreate, nodeLocation, addressOutpointMap, blake3pow.logger)
if chain.Config().IndexAddressUtxos {
chain.WriteAddressOutpoints(addressOutpointMap)
Expand Down
2 changes: 1 addition & 1 deletion consensus/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ type ChainHeaderReader interface {
UpdateEtxEligibleSlices(header *types.WorkObject, location common.Location) common.Hash

// WriteAddressOutpoints writes the address outpoints to the database
WriteAddressOutpoints(outpointsMap map[string]map[string]*types.OutpointAndDenomination) error
WriteAddressOutpoints(outpointsMap map[[20]byte][]*types.OutpointAndDenomination) error

// WorkShareDistance calculates the geodesic distance between the
// workshare and the workobject in which that workshare is included.
Expand Down
2 changes: 1 addition & 1 deletion consensus/progpow/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ func (progpow *Progpow) Finalize(chain consensus.ChainHeaderReader, batch ethdb.
continue
}
}
addressOutpointMap := make(map[string]map[string]*types.OutpointAndDenomination)
addressOutpointMap := make(map[[20]byte][]*types.OutpointAndDenomination)
core.AddGenesisUtxos(chain.Database(), &utxosCreate, nodeLocation, addressOutpointMap, progpow.logger)
if chain.Config().IndexAddressUtxos {
chain.WriteAddressOutpoints(addressOutpointMap)
Expand Down
Loading

0 comments on commit e0216d9

Please sign in to comment.