diff --git a/doc/files.md b/doc/files.md index 98a358a9394e..4f655a672471 100644 --- a/doc/files.md +++ b/doc/files.md @@ -54,6 +54,7 @@ Subdirectory | File(s) | Description `indexes/blockfilter/basic/db/` | LevelDB database | Blockfilter index LevelDB database for the basic filtertype; *optional*, used if `-blockfilterindex=basic` `indexes/blockfilter/basic/` | `fltrNNNNN.dat`[\[2\]](#note2) | Blockfilter index filters for the basic filtertype; *optional*, used if `-blockfilterindex=basic` `indexes/coinstats/db/` | LevelDB database | Coinstats index; *optional*, used if `-coinstatsindex=1` +`indexes/govcollateralindex/` | LevelDB database | Governance proposal collateral index `wallets/` | | [Contains wallets](#multi-wallet-environment); can be specified by `-walletdir` option; if `wallets/` subdirectory does not exist, wallets reside in the [data directory](#data-directory-location) `./` | `anchors.dat` | Anchor IP address database, created on shutdown and deleted at startup. Anchors are last known outgoing block-relay-only peers that are tried to re-connect to on startup `evodb/` | |special txes and quorums database diff --git a/doc/release-notes-7860.md b/doc/release-notes-7860.md new file mode 100644 index 000000000000..9f7a1807eca1 --- /dev/null +++ b/doc/release-notes-7860.md @@ -0,0 +1,40 @@ +Governance +---------- + +- Pruned nodes can now run governance. Proposal collateral is now looked up + in a new governance collateral index instead of `-txindex`. The index + stores only the transactions that could be a proposal's collateral, works + with `-prune`, and always runs; there is no option for it. Pruned nodes, and + nodes started with `-txindex=0`, now sync proposals and votes, check + superblock payments in full, and can create and submit proposals. + +- Every node builds the index once, on the first start after upgrading. It + reads every block for that, and the node's governance sync waits until it + has finished. + +- A node that pruned blocks before it had this index can't build it, because + the index has to start from the genesis block. It now starts with governance + turned off and a warning instead of failing; restarting it once with + `-reindex` downloads the blockchain again and enables governance, and the + node stays pruned. This replaces the warning such nodes showed before, that + governance is disabled because the node is pruned. + +- Dash-Qt used to save `disablegovernance=1` in `settings.json` when pruning + was turned on in the options. That setting stays until it is removed, so + governance stays off on those nodes. + +- `gobject prepare` and `gobject submit` now fail straight away on a node that + can't check or relay proposals. Before, `gobject prepare` burned the + proposal fee and only `gobject submit` failed afterwards, with the + misleading error `Invalid proposal collateral`. Collateral errors now also + say what is wrong with the collateral instead of only + `Invalid proposal collateral`. + +- Pruned nodes now check superblock payments against the governance + triggers they know, like full nodes do, instead of only checking that a + superblock stays within the budget. + +- `getindexinfo` reports the new index as `govcollateralindex`. + +- Starting with `-prune` and `-disablegovernance=0` is no longer an error. + Governance validation no longer needs `-txindex`. diff --git a/src/Makefile.am b/src/Makefile.am index ad095c971a9f..117325f569f3 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -251,6 +251,7 @@ BITCOIN_CORE_H = \ external_signer.h \ flat-database.h \ flatfile.h \ + governance/collateral.h \ governance/common.h \ governance/governance.h \ governance/net_governance.h \ @@ -271,6 +272,7 @@ BITCOIN_CORE_H = \ index/blockfilterindex.h \ index/coinstatsindex.h \ index/disktxpos.h \ + index/govcollateralindex.h \ index/spentindex.h \ index/spentindex_types.h \ index/timestampindex.h \ @@ -574,6 +576,7 @@ libbitcoin_node_a_SOURCES = \ evo/specialtx_filter.cpp \ evo/specialtxman.cpp \ flatfile.cpp \ + governance/collateral.cpp \ governance/governance.cpp \ governance/net_governance.cpp \ governance/object.cpp \ @@ -590,6 +593,7 @@ libbitcoin_node_a_SOURCES = \ index/base.cpp \ index/blockfilterindex.cpp \ index/coinstatsindex.cpp \ + index/govcollateralindex.cpp \ index/spentindex.cpp \ index/timestampindex.cpp \ index/txindex.cpp \ diff --git a/src/Makefile.test.include b/src/Makefile.test.include index d59f65985291..7a180f80daa4 100644 --- a/src/Makefile.test.include +++ b/src/Makefile.test.include @@ -127,6 +127,7 @@ BITCOIN_TESTS =\ test/flatfile_tests.cpp \ test/fs_tests.cpp \ test/getarg_tests.cpp \ + test/governance_collateral_tests.cpp \ test/governance_inv_tests.cpp \ test/governance_superblock_tests.cpp \ test/governance_validators_tests.cpp \ diff --git a/src/governance/collateral.cpp b/src/governance/collateral.cpp new file mode 100644 index 000000000000..007275a9554f --- /dev/null +++ b/src/governance/collateral.cpp @@ -0,0 +1,35 @@ +// Copyright (c) 2026 The Dash Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#include + +#include +#include