Skip to content

Commit ec10c05

Browse files
Merge #6929: fix: repair makeseeds.py, getblockchaininfo[softforks] help text, drop extra generates from test, resolve macOS GID issue
39e847c fix: do not create group if GID is already taken (Kittywhiskers Van Gogh) 36db83a fix: annotate `getblockchaininfo[softforks]` as `OBJ_DYN` (Kittywhiskers Van Gogh) e4ace44 fix: repair IP extraction in `makeseeds.py`, read from `core_p2p` arr (Kittywhiskers Van Gogh) 9ef8c53 test: drop extra `generate`s from `wallet_signrawtransactionwithwallet` (Kittywhiskers Van Gogh) Pull request description: ## Additional Information * The help text for `getblockchaininfo['softforks']` was introduced in [bitcoin#16060](bitcoin#16060) (backported in [dash#5255](#5255)) _but_ the `RPCResult` help text was introduced in [bitcoin#17809](bitcoin#17809), backported _before_ [bitcoin#16060](bitcoin#16060). This resulted in the help text for `softforks` deviating from upstream without the output to match (which is aligned with upstream). This has since been resolved as the output structure hasn't changed, only the help text. * [bitcoin#22818](bitcoin#22818) (backported in [dash#6214](#6214)) activated many softforks at height 1, which rendered the block generation calls in `wallet_signrawtransactionwithwallet.py` ([source](https://github.com/dashpay/dash/blob/3e6e8f57c45fb24107816a10854ed8f349c4aa20/test/functional/wallet_signrawtransactionwithwallet.py#L132-L133)) no longer necessary, additionally [bitcoin#22550](bitcoin#22550) (backported in [dash#6189](#6189)) added assertions to validate CSV/CLTV activation that were not included in the backport. This has since been resolved, replacing the `generate` calls with assertions. * The locktime height was dropped from `1000` to `100` (matching with upstream, [source](https://github.com/bitcoin/bitcoin/blob/24.x/test/functional/wallet_signrawtransactionwithwallet.py#L219)) as we are no longer generating enough blocks to reach that height anymore. * `makeseeds.py` is currently mangled because [dash#6666](#6666) updated the script to look for the `core_p2p` purpose even though purpose code support was spun-off into [dash#6674](#6674). This meant, in between [dash#6666](#6666) and [dash#6674](#6674 merger, `makeseeds.py` was broken. This necessitated a fix that was introduced as e714c06 ([dash#6858](#6858)) but meant that after [dash#6674](#6674), `makeseeds.py` is broken again. This has been resolved as part of this PR. * macOS users who want to utilise the `develop` container ([source](https://github.com/dashpay/dash/blob/b82450aa7dce2307b13e6fe282f7c4f84b48cbbf/contrib/containers/develop/Dockerfile)) need to set the `USER_ID` and `GROUP_ID` `args` to avoid permissions issues. This creates a slight problem as the GID for `staff` is 20 on macOS but Linux uses GID 20 for `dialout`, so creating a group with GID 20 will _fail_. As we only care about the GID, it is safe to skip the group creation step and assign the user to the group anyways as we do it by GID and _not_ name (the user will be presented as a member of the `dialout` group). This should resolve issues for macOS users trying to build the `develop` container. ## Breaking Changes None expected. ## Checklist - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas **(note: N/A)** - [x] I have added or updated relevant unit/integration/functional/e2e tests - [x] I have made corresponding changes to the documentation **(note: N/A)** - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: PastaPastaPasta: utACK 39e847c knst: utACK 39e847c UdjinM6: utACK 39e847c Tree-SHA512: 0ecb8bb930d54d4b9024a6e94a2fe3b49c7334666e5f67d38920ac58f54332fb8b4f62bd883bd949969d60b6b5183c7a20a3593f24c2e6bbbb0de143b3de8fe1
2 parents 5e023dc + 39e847c commit ec10c05

File tree

4 files changed

+29
-26
lines changed

4 files changed

+29
-26
lines changed

contrib/containers/ci/ci-slim.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ RUN set -ex; \
106106
ARG USER_ID=1000 \
107107
GROUP_ID=1000
108108
RUN set -ex; \
109-
groupmod -g ${GROUP_ID} -n dash ubuntu; \
109+
getent group ${GROUP_ID} || groupmod -g ${GROUP_ID} -n dash ubuntu; \
110110
usermod -u ${USER_ID} -md /home/dash -l dash ubuntu; \
111111
chown ${USER_ID}:${GROUP_ID} -R /home/dash; \
112112
mkdir -p /src/dash && \

contrib/seeds/makeseeds.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def main():
206206
print(f'After removing duplicates: {len(mns)}', file=sys.stderr)
207207

208208
# Extract IPs
209-
ips = [parseip(mn['state']['addresses'][0]) for mn in mns]
209+
ips = [parseip(mn['state']['addresses']['core_p2p'][0]) for mn in mns]
210210
for onion in onions:
211211
parsed = parseip(onion)
212212
if parsed is not None:

src/rpc/blockchain.cpp

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1462,31 +1462,34 @@ RPCHelpMan getblockchaininfo()
14621462
{RPCResult::Type::NUM, "pruneheight", /*optional=*/true, "height of the last block pruned, plus one (only present if pruning is enabled)"},
14631463
{RPCResult::Type::BOOL, "automatic_pruning", /*optional=*/true, "whether automatic pruning is enabled (only present if pruning is enabled)"},
14641464
{RPCResult::Type::NUM, "prune_target_size", /*optional=*/true, "the target size used by pruning (only present if automatic pruning is enabled)"},
1465-
{RPCResult::Type::OBJ, "softforks", "status of softforks in progress",
1465+
{RPCResult::Type::OBJ_DYN, "softforks", "status of softforks in progress",
14661466
{
1467-
{RPCResult::Type::STR, "type", "one of \"buried\", \"bip9\""},
1468-
{RPCResult::Type::OBJ, "bip9", /*optional=*/true, "status of bip9 softforks (only for \"bip9\" type)",
1467+
{RPCResult::Type::OBJ, "xxxx", "name of the softfork",
14691468
{
1470-
{RPCResult::Type::STR, "status", "one of \"defined\", \"started\", \"locked_in\", \"active\", \"failed\""},
1471-
{RPCResult::Type::NUM, "bit", /*optional=*/true, "the bit (0-28) in the block version field used to signal this softfork (only for \"started\" and \"locked_in\" status)"},
1472-
{RPCResult::Type::NUM_TIME, "start_time", "the minimum median time past of a block at which the bit gains its meaning"},
1473-
{RPCResult::Type::NUM_TIME, "timeout", "the median time past of a block at which the deployment is considered failed if not yet locked in"},
1474-
{RPCResult::Type::BOOL, "ehf", "returns true for EHF activated forks"},
1475-
{RPCResult::Type::NUM, "ehf_height", /*optional=*/true, "the minimum height when miner's signals for the deployment matter. Below this height miner signaling cannot trigger hard fork lock-in. Not specified for non-EHF forks"},
1476-
{RPCResult::Type::NUM, "since", "height of the first block to which the status applies"},
1477-
{RPCResult::Type::NUM, "activation_height", "expected activation height for this softfork (only for \"locked_in\" status)"},
1478-
{RPCResult::Type::NUM, "min_activation_height", "minimum height of blocks for which the rules may be enforced"},
1479-
{RPCResult::Type::OBJ, "statistics", /*optional=*/true, "numeric statistics about signalling for a softfork (only for \"started\" and \"locked_in\" status)",
1469+
{RPCResult::Type::STR, "type", "one of \"buried\", \"bip9\""},
1470+
{RPCResult::Type::OBJ, "bip9", /*optional=*/true, "status of bip9 softforks (only for \"bip9\" type)",
14801471
{
1481-
{RPCResult::Type::NUM, "period", "the length in blocks of the signalling period"},
1482-
{RPCResult::Type::NUM, "threshold", /*optional=*/true, "the number of blocks with the version bit set required to activate the feature (only for \"started\" status)"},
1483-
{RPCResult::Type::NUM, "elapsed", "the number of blocks elapsed since the beginning of the current period"},
1484-
{RPCResult::Type::NUM, "count", "the number of blocks with the version bit set in the current period"},
1485-
{RPCResult::Type::BOOL, "possible", /*optional=*/true, "returns false if there are not enough blocks left in this period to pass activation threshold (only for \"started\" status)"},
1472+
{RPCResult::Type::STR, "status", "one of \"defined\", \"started\", \"locked_in\", \"active\", \"failed\""},
1473+
{RPCResult::Type::NUM, "bit", /*optional=*/true, "the bit (0-28) in the block version field used to signal this softfork (only for \"started\" and \"locked_in\" status)"},
1474+
{RPCResult::Type::NUM_TIME, "start_time", "the minimum median time past of a block at which the bit gains its meaning"},
1475+
{RPCResult::Type::NUM_TIME, "timeout", "the median time past of a block at which the deployment is considered failed if not yet locked in"},
1476+
{RPCResult::Type::BOOL, "ehf", "returns true for EHF activated forks"},
1477+
{RPCResult::Type::NUM, "ehf_height", /*optional=*/true, "the minimum height when miner's signals for the deployment matter. Below this height miner signaling cannot trigger hard fork lock-in. Not specified for non-EHF forks"},
1478+
{RPCResult::Type::NUM, "since", "height of the first block to which the status applies"},
1479+
{RPCResult::Type::NUM, "activation_height", "expected activation height for this softfork (only for \"locked_in\" status)"},
1480+
{RPCResult::Type::NUM, "min_activation_height", "minimum height of blocks for which the rules may be enforced"},
1481+
{RPCResult::Type::OBJ, "statistics", /*optional=*/true, "numeric statistics about signalling for a softfork (only for \"started\" and \"locked_in\" status)",
1482+
{
1483+
{RPCResult::Type::NUM, "period", "the length in blocks of the signalling period"},
1484+
{RPCResult::Type::NUM, "threshold", /*optional=*/true, "the number of blocks with the version bit set required to activate the feature (only for \"started\" status)"},
1485+
{RPCResult::Type::NUM, "elapsed", "the number of blocks elapsed since the beginning of the current period"},
1486+
{RPCResult::Type::NUM, "count", "the number of blocks with the version bit set in the current period"},
1487+
{RPCResult::Type::BOOL, "possible", /*optional=*/true, "returns false if there are not enough blocks left in this period to pass activation threshold (only for \"started\" status)"},
1488+
}},
14861489
}},
1490+
{RPCResult::Type::NUM, "height", /*optional=*/true, "height of the first block which the rules are or will be enforced (only for \"buried\" type, or \"bip9\" type with \"active\" status)"},
1491+
{RPCResult::Type::BOOL, "active", "true if the rules are enforced for the mempool and the next block"},
14871492
}},
1488-
{RPCResult::Type::NUM, "height", /*optional=*/true, "height of the first block which the rules are or will be enforced (only for \"buried\" type, or \"bip9\" type with \"active\" status)"},
1489-
{RPCResult::Type::BOOL, "active", "true if the rules are enforced for the mempool and the next block"},
14901493
}},
14911494
{RPCResult::Type::STR, "warnings", "any network and blockchain warnings"},
14921495
}},

test/functional/wallet_signrawtransactionwithwallet.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def test_signing_with_csv(self):
130130
getcontext().prec = 8
131131

132132
# Make sure CSV is active
133-
self.generate(self.nodes[0], 500)
133+
assert self.nodes[0].getblockchaininfo()['softforks']['csv']['active']
134134

135135
# Create a P2SH script with CSV
136136
script = CScript([1, OP_CHECKSEQUENCEVERIFY, OP_DROP, OP_TRUE])
@@ -159,11 +159,11 @@ def test_signing_with_cltv(self):
159159
self.nodes[0].walletpassphrase("password", 9999)
160160
getcontext().prec = 8
161161

162-
# Make sure CSV is active
163-
self.generate(self.nodes[0], 1500)
162+
# Make sure CLTV is active
163+
assert self.nodes[0].getblockchaininfo()['softforks']['bip65']['active']
164164

165165
# Create a P2SH script with CLTV
166-
script = CScript([1000, OP_CHECKLOCKTIMEVERIFY, OP_DROP, OP_TRUE])
166+
script = CScript([100, OP_CHECKLOCKTIMEVERIFY, OP_DROP, OP_TRUE])
167167
address = script_to_p2sh(script)
168168

169169
# Fund that address and make the spend

0 commit comments

Comments
 (0)