Every getblocktemplate call reads the state and the mempool, runs ZIP-317 transaction selection, and builds a coinbase transaction, which runs a shielded proof when the miner address has a shielded component. Miners short-poll far more often than the chain tip or the mempool change, so each call pays that cost again, and concurrent long-polls each precompute their own next-tip coinbase (#10747).
Zebra should keep a block template for the current chain tip ready in the background and answer getblocktemplate from it, without reading the state or the mempool on the request path. A precomputed template may be a few seconds behind the mempool, since the next call picks up newer transactions. It must never be behind the chain: a template for height n must not be returned once the tip is at height n.
Part of #11310. Subsumes the suggested fix in #10747.
Every
getblocktemplatecall reads the state and the mempool, runs ZIP-317 transaction selection, and builds a coinbase transaction, which runs a shielded proof when the miner address has a shielded component. Miners short-poll far more often than the chain tip or the mempool change, so each call pays that cost again, and concurrent long-polls each precompute their own next-tip coinbase (#10747).Zebra should keep a block template for the current chain tip ready in the background and answer
getblocktemplatefrom it, without reading the state or the mempool on the request path. A precomputed template may be a few seconds behind the mempool, since the next call picks up newer transactions. It must never be behind the chain: a template for heightnmust not be returned once the tip is at heightn.Part of #11310. Subsumes the suggested fix in #10747.