-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
main, wire, blockchain, indexers, ffldb: Add pruning #1971
Commits on Aug 4, 2023
-
database/ffldb: Change scanBlockFiles behavior
This change is part of the effort to add pruning support to btcd. scanBlockFiles nows supports scanning files from an arbitrary block number. When blocks are pruned, the file number may not start from 0. To account for this, scanBlockFiles now scans and retreives the start and the end block file numbers and scans those files.
Configuration menu - View commit details
-
Copy full SHA for f258d0c - Browse repository at this point
Copy the full SHA f258d0cView commit details
Commits on Aug 22, 2023
-
database/ffldb: Add PruneBlocks to db interface
This change is part of the effort to add pruning support to btcd. PruneBlocks will prune the earliest block files until it reaches the given target size. The returned hashes are the hashes of the blocks that were pruned.
Configuration menu - View commit details
-
Copy full SHA for 5c1dd21 - Browse repository at this point
Copy the full SHA 5c1dd21View commit details -
blockchain: Add pruning support
This change is part of the effort to add pruning support to btcd. A field for pruning is added and the BlockChain struct is now able to be configured with pruning. Prune is called on every block connect and the prune target field is passed to PruneBlocks func. There's no check to keep the latest 288 blocks to abide by the NODE_NETWORK_LIMITED rule. That'll have to be enforced by the caller creating the BlockChain struct.
Configuration menu - View commit details
-
Copy full SHA for 57ec43f - Browse repository at this point
Copy the full SHA 57ec43fView commit details -
wire, main: Add SFNodeNetworkLimited flag
This change is part of the effort to add pruning support to btcd. Wire now supports the ability to signal NODE_NETWORK_LIMITED which signals to peers that the node is able to serve the last 288 blocks. Since archival nodes have all blocks, they can also signal for NODE_NETWORK_LIMITED. SFNodeNetworkLimited flag is added to the default services.
Configuration menu - View commit details
-
Copy full SHA for 0212c33 - Browse repository at this point
Copy the full SHA 0212c33View commit details -
This change is part of the effort to add pruning support to btcd. Pruning is now available to the end user via --prune flag. There are checks in place so that the user doesn't go below the minimum prune target of 1536 MiB. The minimum is set so that we keep at least 288 blocks per the requirement for NODE_NETWORK_LIMITED nodes specified by BIP0159. The default value of 0 will disable pruning.
Configuration menu - View commit details
-
Copy full SHA for 02469e1 - Browse repository at this point
Copy the full SHA 02469e1View commit details -
main: Disable enabling both --prune and --txindex
You can have a txindex but with the actual blocks gone, they won't be much of a help. Consider allowing these option to be both on in the future where the txindex is only indexing the non-pruned blocks.
Configuration menu - View commit details
-
Copy full SHA for a1736b4 - Browse repository at this point
Copy the full SHA a1736b4View commit details -
main: Disable enabling both --prune and --addrindex
You can have a addrindex but with the actual blocks gone, they won't be much of a help. Consider allowing these option to be both on in the future where the addrindex is only indexing the non-pruned blocks.
Configuration menu - View commit details
-
Copy full SHA for 57903c7 - Browse repository at this point
Copy the full SHA 57903c7View commit details -
database, database/ffldb: add BeenPruned() method
This change is part of the effort to add pruning support to btcd. BeenPruned will return true if the database has ever been pruned. This allows for accurate prune status to be reported as well as ux improvements by disallowing the user to accidently remove or enable indexes.
Configuration menu - View commit details
-
Copy full SHA for aaedc11 - Browse repository at this point
Copy the full SHA aaedc11View commit details -
main: force user to enable pruning if database is already pruned
This change is part of the effort to add pruning support to btcd. Allowing the user to not pass in the --prune flag after pruning results in inaccurate reporting of the prune status for getblockchaininfo and for signaling NODE_NETWORK_LIMITED to peers. Anything that relies on cfg.Prune to be accurate is at risk of being incorrect. To solve the current problems and to prevent potential future problems, just force the user to keep the prune flag on like bitcoind. In terms of UX, there isn't that much of a loss since if the user wants to keep more blocks than they previously did, they can just increase the size passed to --prune.
Configuration menu - View commit details
-
Copy full SHA for 56f3463 - Browse repository at this point
Copy the full SHA 56f3463View commit details -
main: fetch prune status from db for handleGetBlockChainInfo
This change is part of the effort to add pruning support to btcd. Now that pruning is allowed in btcd, accurately report the prune status back to the user.
Configuration menu - View commit details
-
Copy full SHA for 47261ef - Browse repository at this point
Copy the full SHA 47261efView commit details -
blockchain/indexers: add functions to report init status
This change is part of the effort to add pruning support to btcd. The added *Initialized() functions to each of the indexers allow for callers to check if each of the indexes have been created. It's useful for ux improvements where we force the user to manually drop indexes that aren't compatible with pruning when the user enables pruning.
Configuration menu - View commit details
-
Copy full SHA for e27fcac - Browse repository at this point
Copy the full SHA e27fcacView commit details -
main: force the user to drop tx and addr indexes for pruning
This change is part of the effort to add pruning support to btcd. The addr and tx indexes are not useful when the node is pruned as the actual block data that the indexes point to are gone. If the user had previously enabled them, then explicitly require an action from the user to remove the indexes before letting the user enable pruning.
Configuration menu - View commit details
-
Copy full SHA for f161a31 - Browse repository at this point
Copy the full SHA f161a31View commit details -
main: return error if user requests addr or tx index while pruned
This change is part of the effort to add pruning support to btcd. It's not possible to generate the addr or tx indexes from scratch if the block storage had been pruned previously as it's missing the block data. When the user asks to create these indexes, tell them it's not possible and the only way it's possible is if they delete and start anew.
Configuration menu - View commit details
-
Copy full SHA for 8f8040e - Browse repository at this point
Copy the full SHA 8f8040eView commit details -
main: cfindex related sanity checks when enabled with pruning
This change is part of the effort to add pruning support to btcd. cfIndex is a useful index even if the node has been pruned so it's allowed to be enabled together with pruning. However, if the user had disabled cfindex and enabled pruning, it's not possible to generate them. In this case, we tell the user that it's impossible unless the user deletes and start anew. Additionally, if the user had enabled cfindex and also enabled pruning from the start, don't let the user turn the cfindex off without dropping it explicitly. This is to make sure that the user isn't left at an inconsistent state where the cfindex isn't able to catch up to the tip because the blocks have already been pruned.
Configuration menu - View commit details
-
Copy full SHA for 65c7299 - Browse repository at this point
Copy the full SHA 65c7299View commit details