Skip to content

Commit

Permalink
Make a note that genesis does not produce a spent output
Browse files Browse the repository at this point in the history
  • Loading branch information
marcopeereboom committed Jul 17, 2024
1 parent de9dbc0 commit 884fd91
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions service/tbc/crawler.go
Original file line number Diff line number Diff line change
Expand Up @@ -1100,6 +1100,9 @@ func (s *Server) IndexIsLinear(ctx context.Context, startHash, endHash *chainhas

// SyncIndexersToHash tries to move the various indexers to the supplied
// height (inclusive).
// Note: on unwind it means that it WILL unwind the the various indexers
// including the hash that was passed in. E.g. if this unwinds from 1001 to
// 1000 the indexes for block 1000 WILL be updated as well.
func (s *Server) SyncIndexersToHash(ctx context.Context, hash *chainhash.Hash) error {
log.Tracef("SyncIndexersToHash")
defer log.Tracef("SyncIndexersToHash exit")
Expand Down
6 changes: 6 additions & 0 deletions service/tbc/tbcfork_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1223,11 +1223,17 @@ func TestIndexNoFork(t *testing.T) {
if err != nil {
t.Fatal(err)
}

// grab genesis tx and make sure it exists in the db
genesisTx, err := s.TxByTxId(ctx, g.Hash())
if err != nil {
t.Fatal(err)
}
t.Logf("%v", spew.Sdump(genesisTx))
_, err = s.SpendOutputsByTxId(ctx, g.Hash())
if err == nil {
t.Fatal("genesis coinbase tx should not be spent")
}

// XXX verify the balances
for address := range n.keys {
Expand Down

0 comments on commit 884fd91

Please sign in to comment.