From c8abd8fe93b840445ed3b501962298b311f542dc Mon Sep 17 00:00:00 2001 From: Roy Lee Date: Wed, 6 Jun 2018 13:22:50 -0700 Subject: [PATCH] [lbry] blockchain: make UTXO in Genesis block spendable --- blockchain/chain.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/blockchain/chain.go b/blockchain/chain.go index eea603ce..1a95a00b 100644 --- a/blockchain/chain.go +++ b/blockchain/chain.go @@ -1764,6 +1764,20 @@ func New(config *Config) (*BlockChain, error) { return nil, err } + // Helper function to insert the output in genesis block in to the + // transaction database. + fn := func(dbTx database.Tx) error { + genesisBlock := btcutil.NewBlock(b.chainParams.GenesisBlock) + view := NewUtxoViewpoint() + if err := view.connectTransactions(genesisBlock, nil); err != nil { + return err + } + return dbPutUtxoView(dbTx, view) + } + if err := b.db.Update(fn); err != nil { + return nil, err + } + // Perform any upgrades to the various chain-specific buckets as needed. if err := b.maybeUpgradeDbBuckets(config.Interrupt); err != nil { return nil, err