You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
getblocktemplate includes the fee for each transaction, but getblock does not. So we can calculate the fee for omitted transactions, but not for added transactions.
Bitcoin Core v22 adds support for getting the transaction fee via RPC: bitcoin/bitcoin#18772
This is more complicated than it seems: in order to calculate the fee for a transaction, you need to know the output amounts (which are in the current block) and the input amounts (which are in previous blocks). Fortunately Bitcoin Core also tracks those input amounts in the undo data, which is used when rolling back a block. The above PR uses that undo data to get the fee.
Once released (or we can use the master branch) we need to change Node.get_coinbase_and_tx_ids_for_block, Block.find_or_create_block_and_ancestors and Block.find_missing to use getblock with verbosity 2 rather than 1.
This may require additional refactoring, because so far we would fetch the block from whichever node first told us about it. But now we have to always fetch the full block from v22, which may not have it yet. Instead, it might be better to generalise match_missing_pools! to include obtaining fee info.
The text was updated successfully, but these errors were encountered:
getblocktemplate
includes the fee for each transaction, butgetblock
does not. So we can calculate the fee for omitted transactions, but not for added transactions.Bitcoin Core v22 adds support for getting the transaction fee via RPC: bitcoin/bitcoin#18772
This is more complicated than it seems: in order to calculate the fee for a transaction, you need to know the output amounts (which are in the current block) and the input amounts (which are in previous blocks). Fortunately Bitcoin Core also tracks those input amounts in the undo data, which is used when rolling back a block. The above PR uses that undo data to get the fee.
Once released (or we can use the master branch) we need to change
Node.get_coinbase_and_tx_ids_for_block
,Block.find_or_create_block_and_ancestors
andBlock.find_missing
to usegetblock
with verbosity2
rather than1
.This may require additional refactoring, because so far we would fetch the block from whichever node first told us about it. But now we have to always fetch the full block from v22, which may not have it yet. Instead, it might be better to generalise
match_missing_pools!
to include obtaining fee info.The text was updated successfully, but these errors were encountered: