From 884fd9142fda7e307b800b27b52a808cd2be08b2 Mon Sep 17 00:00:00 2001 From: Marco Peereboom Date: Wed, 17 Jul 2024 16:06:09 +0100 Subject: [PATCH] Make a note that genesis does not produce a spent output --- service/tbc/crawler.go | 3 +++ service/tbc/tbcfork_test.go | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/service/tbc/crawler.go b/service/tbc/crawler.go index 97de840f7..c65948224 100644 --- a/service/tbc/crawler.go +++ b/service/tbc/crawler.go @@ -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") diff --git a/service/tbc/tbcfork_test.go b/service/tbc/tbcfork_test.go index 27bc693fa..7ee99b12b 100644 --- a/service/tbc/tbcfork_test.go +++ b/service/tbc/tbcfork_test.go @@ -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 {