From 02567db254c9143279fa59cce42d8ea2fe73dcd3 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Tue, 20 Apr 2021 01:23:58 -0500 Subject: [PATCH] blockchain: Trsy always inactive for genesis blk. This modifies the IsTreasuryAgendaActive method to return false when a zero hash is provided since that indicates the next block is the genesis block and the treasury agenda is always inactive for the genesis block. This has the effect of fixing a few RPC handlers, such as getblock, when working with the genesis block. --- blockchain/thresholdstate.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/blockchain/thresholdstate.go b/blockchain/thresholdstate.go index 392ec5c7..b73a44bd 100644 --- a/blockchain/thresholdstate.go +++ b/blockchain/thresholdstate.go @@ -717,6 +717,11 @@ func (b *BlockChain) isTreasuryAgendaActive(prevNode *blockNode) (bool, error) { // // This function is safe for concurrent access. func (b *BlockChain) IsTreasuryAgendaActive(prevHash *chainhash.Hash) (bool, error) { + // The treasury agenda is never active for the genesis block. + if *prevHash == *zeroHash { + return false, nil + } + prevNode := b.index.LookupNode(prevHash) if prevNode == nil || !b.index.CanValidate(prevNode) { return false, unknownBlockError(prevHash)