mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-15 12:51:00 +02:00
Merge branch 'master' into release-elements-0.21.0.1
This commit is contained in:
commit
e76337b48c
20 changed files with 165 additions and 58 deletions
|
|
@ -482,7 +482,7 @@ extra_args = [
|
|||
"-con_max_block_sig_size=150",
|
||||
# We also disable dynamic federations, since we are not going to do any
|
||||
# dynafed transitions in this tutorial. FIXME we probably should.
|
||||
"-con_dyna_deploy_start=0",
|
||||
"-evbparams=dynafed:0:::",
|
||||
]
|
||||
|
||||
print ("6b. Restart both nodes")
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ This BIP is licensed under the 2-clause BSD license.
|
|||
|
||||
==Specification==
|
||||
|
||||
The Partially Signed ELements Transaction (PSET) format is identical to the BIP 370 PSBT format.
|
||||
The Partially Signed Elements Transaction (PSET) format is identical to the BIP 370 PSBT format.
|
||||
The changes are new proprietary type fields, a new magic sequence, and new roles.
|
||||
The fields added for PSET are only allowed when the PSBT version is 2.
|
||||
|
||||
|
|
@ -60,13 +60,13 @@ The currently defined elements global proprietary types are as follows:
|
|||
| None
|
||||
| No key data
|
||||
| <tt><8-bit uint></tt>
|
||||
| An 8 bit little endian unsigned integer as a bitfield for various elements specific transaction modification flags. Bit 0 is the PSBT Blinded flag and it is set to 1 to indicate that the PSET has not been blinded yet. Once all confidential values, rangeproofs, and asset surjection proofs have been attached to the PSET, it must be set to 0.
|
||||
| An 8 bit little endian unsigned integer as a bitfield for various elements specific transaction modification flags. Bit 0 is the PSET Blinded flag and it is set to 1 to indicate that the PSET has not been blinded yet. Once all confidential values, rangeproofs, and asset surjection proofs have been attached to the PSET, it must be set to 0.
|
||||
|
|
||||
| 0
|
||||
| 2
|
||||
|}
|
||||
|
||||
The currently defined elements per-input proprietary types are as folows:
|
||||
The currently defined elements per-input proprietary types are as follows:
|
||||
|
||||
{|
|
||||
! Name
|
||||
|
|
@ -213,7 +213,7 @@ The currently defined elements per-input proprietary types are as folows:
|
|||
| <tt>PSBT_ELEMENTS_IN_ISSUANCE_ASSET_ENTROPY = 0x0d</tt>
|
||||
| None
|
||||
| No key data
|
||||
| <tt><32 byte entrpy></tt>
|
||||
| <tt><32 byte entropy></tt>
|
||||
| The 32 byte asset entropy. For new issuances, an arbitrary and optional 32 bytes of no consensus meaning combined used as additional entropy in the asset tag calculation. For reissuances, the original, final entropy used for the asset tag calculation.
|
||||
|
|
||||
| 0
|
||||
|
|
@ -423,7 +423,7 @@ It will also add the ephemeral pubkey used for ECDH of the nonce for the rangepr
|
|||
|
||||
The blinder will then compute a scalar offset that will be added as a <tt>PSBT_ELEMENTS_GLOBAL_SCALAR</tt>.
|
||||
For each input and output owned/blinded by this blinder, the following formula is computed:
|
||||
<tt> asset_blinding_factor * amount + amount_blinding_factor (mod n)<tt>.
|
||||
<tt> asset_blinding_factor * amount + amount_blinding_factor (mod n)</tt>.
|
||||
The scalars for the inputs are summed, and then that sum is subtracted from the sum of the scalars for the outputs.
|
||||
The result is the scalar offset added as a <tt>PSBT_ELEMENTS_GLOBAL_SCALAR</tt>.
|
||||
|
||||
|
|
@ -441,7 +441,7 @@ A single entity is likely to be a Creator, Updater, and Blinder.
|
|||
|
||||
===Signer===
|
||||
|
||||
In addition to the BIP 370 PSBT Signer behavior, PSET specifies some addtional constraints.
|
||||
In addition to the BIP 370 PSBT Signer behavior, PSET specifies some additional constraints.
|
||||
Before signing, the Signer must check whether blinding is complete. If any output contains a blinding pubkey but no commitments or proofs, then it must not sign.
|
||||
|
||||
===Combiner===
|
||||
|
|
@ -470,4 +470,4 @@ TBD
|
|||
|
||||
==Reference implementation==
|
||||
|
||||
The reference implementation of the PSBT format is available at https://github.com/achow101/elements/tree/pset.
|
||||
The reference implementation of the PSET format is available at https://github.com/achow101/elements/tree/pset.
|
||||
|
|
|
|||
|
|
@ -85,6 +85,96 @@ static CBlock CreateGenesisBlock(uint32_t nTime, uint32_t nNonce, uint32_t nBits
|
|||
return CreateGenesisBlock(params, genesisScriptSig, genesisOutputScript, nTime, nNonce, nBits, nVersion, genesisReward);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows modifying the Version Bits Elements regtest parameters (and liquidv1test).
|
||||
* Ideally, this would be a method in the base class, inherited everywhere, but that might complicate future merges,
|
||||
* so we settle for this static function.
|
||||
*/
|
||||
static void UpdateElementsActivationParametersFromArgs(Consensus::Params& consensus, const ArgsManager& args)
|
||||
{
|
||||
if (!args.IsArgSet("-evbparams")) return;
|
||||
|
||||
std::map<std::string,int> map_deployments;
|
||||
for (const std::string& strDeployment : args.GetArgs("-evbparams")) {
|
||||
std::vector<std::string> vDeploymentParams;
|
||||
boost::split(vDeploymentParams, strDeployment, boost::is_any_of(":"));
|
||||
if (vDeploymentParams.size() != 5) {
|
||||
throw std::runtime_error("ElementsVersion bits parameters malformed, expecting deployment:start:end:period:threshold");
|
||||
}
|
||||
int64_t nStartTime = 0, nTimeout = 0, nPeriod = 0, nThreshold = 0;
|
||||
bool use_nStartTime = false, use_nTimeout = false, use_nPeriod = false, use_nThreshold = false;
|
||||
if(vDeploymentParams[1].length()) {
|
||||
if (!ParseInt64(vDeploymentParams[1], &nStartTime)) {
|
||||
throw std::runtime_error(strprintf("Invalid nStartTime (%s)", vDeploymentParams[1]));
|
||||
}
|
||||
use_nStartTime = true;
|
||||
}
|
||||
if(vDeploymentParams[2].length()) {
|
||||
if (!ParseInt64(vDeploymentParams[2], &nTimeout)) {
|
||||
throw std::runtime_error(strprintf("Invalid nTimeout (%s)", vDeploymentParams[2]));
|
||||
}
|
||||
use_nTimeout = true;
|
||||
}
|
||||
if(vDeploymentParams[3].length()) {
|
||||
if (!ParseInt64(vDeploymentParams[3], &nPeriod)) {
|
||||
throw std::runtime_error(strprintf("Invalid nPeriod (%s)", vDeploymentParams[3]));
|
||||
}
|
||||
use_nPeriod = true;
|
||||
}
|
||||
if(vDeploymentParams[4].length()) {
|
||||
if (!ParseInt64(vDeploymentParams[4], &nThreshold)) {
|
||||
throw std::runtime_error(strprintf("Invalid nThreshold (%s)", vDeploymentParams[4]));
|
||||
}
|
||||
use_nThreshold = true;
|
||||
}
|
||||
bool found = false;
|
||||
for (int j=0; j < (int)Consensus::MAX_VERSION_BITS_DEPLOYMENTS; ++j) {
|
||||
if (vDeploymentParams[0] == VersionBitsDeploymentInfo[j].name) {
|
||||
if(map_deployments[vDeploymentParams[0]]) {
|
||||
found = true;
|
||||
LogPrintf("Ignoring duplicated version bits activation parameters for \"%s\"\n", strDeployment.c_str());
|
||||
break;
|
||||
}
|
||||
std::string extra_logging;
|
||||
map_deployments[vDeploymentParams[0]]=1;
|
||||
Consensus::DeploymentPos d=Consensus::DeploymentPos(j);
|
||||
if (use_nStartTime) {
|
||||
consensus.vDeployments[d].nStartTime = nStartTime;
|
||||
} else {
|
||||
nStartTime =consensus.vDeployments[d].nStartTime;
|
||||
}
|
||||
if (use_nTimeout) {
|
||||
consensus.vDeployments[d].nTimeout = nTimeout;
|
||||
} else {
|
||||
nTimeout = consensus.vDeployments[d].nTimeout;
|
||||
}
|
||||
if (consensus.vDeployments[d].nPeriod) {
|
||||
if(use_nPeriod) {
|
||||
consensus.vDeployments[d].nPeriod = nPeriod;
|
||||
} else {
|
||||
nPeriod = *consensus.vDeployments[d].nPeriod;
|
||||
}
|
||||
extra_logging+= strprintf(", period=%ld", nPeriod);
|
||||
}
|
||||
if (consensus.vDeployments[d].nThreshold) {
|
||||
if(use_nThreshold) {
|
||||
consensus.vDeployments[d].nThreshold = nThreshold;
|
||||
} else {
|
||||
nThreshold = *consensus.vDeployments[d].nThreshold;
|
||||
}
|
||||
extra_logging+= strprintf(", threshold=%ld", nThreshold);
|
||||
}
|
||||
found = true;
|
||||
LogPrintf("Setting version bits activation parameters for %s to start=%ld, timeout=%ld%s\n", vDeploymentParams[0], nStartTime, nTimeout, extra_logging.c_str());
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
throw std::runtime_error(strprintf("Invalid deployment (%s)", vDeploymentParams[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Main network
|
||||
*/
|
||||
|
|
@ -478,7 +568,7 @@ public:
|
|||
consensus.vDeployments[Consensus::DEPLOYMENT_DYNA_FED].nStartTime = 1199145601; // January 1, 2008
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_DYNA_FED].nTimeout = 1230767999; // December 31, 2008
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].bit = 2;
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nStartTime = gArgs.GetArg("-con_taproot_signal_start", Consensus::BIP9Deployment::ALWAYS_ACTIVE);
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nStartTime = Consensus::BIP9Deployment::ALWAYS_ACTIVE;
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nPeriod = 128; // test ability to change from default
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nThreshold = 128;
|
||||
|
|
@ -749,8 +839,10 @@ class CCustomParams : public CRegTestParams {
|
|||
}
|
||||
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_DYNA_FED].bit = 25;
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_DYNA_FED].nStartTime = args.GetArg("-con_dyna_deploy_start", Consensus::BIP9Deployment::ALWAYS_ACTIVE);
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_DYNA_FED].nStartTime = Consensus::BIP9Deployment::ALWAYS_ACTIVE;
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_DYNA_FED].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
|
||||
|
||||
UpdateElementsActivationParametersFromArgs(consensus, args);
|
||||
// END ELEMENTS fields
|
||||
}
|
||||
|
||||
|
|
@ -1011,7 +1103,7 @@ public:
|
|||
// Activated from block 1,000,000.
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_DYNA_FED].bit = 25;
|
||||
// Allow blocksigners to delay activation.
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_DYNA_FED].nStartTime = gArgs.GetArg("-con_dyna_deploy_start", 1000000);
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_DYNA_FED].nStartTime = 1000000;
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_DYNA_FED].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
|
||||
|
||||
|
||||
|
|
@ -1064,6 +1156,9 @@ public:
|
|||
// For testing purposes, default to the same junk keys that CustomParams uses (this can be overridden.)
|
||||
consensus.first_extension_space = {ParseHex("02fcba7ecf41bc7e1be4ee122d9d22e3333671eb0a3a87b5cdf099d59874e1940f02fcba7ecf41bc7e1be4ee122d9d22e3333671eb0a3a87b5cdf099d59874e1940f")};
|
||||
|
||||
// Don't use liquidv1's height to enable taproot
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nStartTime = 0;
|
||||
|
||||
// Use all regtest rather than mainchain magic numbers:
|
||||
bech32_hrp = args.GetArg("-bech32_hrp", "ert");
|
||||
blech32_hrp = args.GetArg("-blech32_hrp", "el");
|
||||
|
|
@ -1101,9 +1196,6 @@ public:
|
|||
// This is unlike the CCustomParams UpdateFromArgs method, which has lots of defaults in it.
|
||||
void UpdateFromArgs(const ArgsManager& args)
|
||||
{
|
||||
// NOTE: We don't handle version bits, because I'm not sure we actually use them, and it would be messy to do so.
|
||||
// UpdateVersionBitsParametersFromArgs(args);
|
||||
|
||||
consensus.nSubsidyHalvingInterval = args.GetArg("-con_nsubsidyhalvinginterval", consensus.nSubsidyHalvingInterval);
|
||||
if (args.IsArgSet("-con_bip16exception")) {
|
||||
consensus.BIP16Exception = uint256S(args.GetArg("-con_bip16exception", ""));
|
||||
|
|
@ -1269,15 +1361,11 @@ public:
|
|||
consensus.subsidy_asset = CAsset(uint256S(args.GetArg("-subsidyasset", "")));
|
||||
}
|
||||
|
||||
if (args.IsArgSet("-con_dyna_deploy_start")) {
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_DYNA_FED].bit = 25;
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_DYNA_FED].nStartTime = args.GetArg("-con_dyna_deploy_start", Consensus::BIP9Deployment::ALWAYS_ACTIVE);
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_DYNA_FED].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
|
||||
}
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_DYNA_FED].bit = 25;
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_DYNA_FED].nStartTime = Consensus::BIP9Deployment::ALWAYS_ACTIVE;
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_DYNA_FED].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
|
||||
|
||||
if (args.IsArgSet("-con_taproot_signal_start")) {
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nStartTime = gArgs.GetArg("-con_taproot_signal_start", 0);
|
||||
}
|
||||
UpdateElementsActivationParametersFromArgs(consensus, args);
|
||||
|
||||
// END ELEMENTS fields
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,11 +56,10 @@ void SetupChainParamsBaseOptions(ArgsManager& argsman)
|
|||
argsman.AddArg("-pak", "Sets the 'first extension space' field to the pak entries ala pre-dynamic federations. Only used for testing in custom chains.", ArgsManager::ALLOW_ANY, OptionsCategory::ELEMENTS);
|
||||
argsman.AddArg("-multi_data_permitted", "Allow relay of multiple OP_RETURN outputs. (default: -enforce_pak)", ArgsManager::ALLOW_ANY, OptionsCategory::ELEMENTS);
|
||||
argsman.AddArg("-con_csv_deploy_start", "Starting height for CSV deployment. (default: -1, which means ACTIVE from genesis)", ArgsManager::ALLOW_ANY, OptionsCategory::ELEMENTS);
|
||||
argsman.AddArg("-con_dyna_deploy_start", "Starting height for Dynamic Federations deployment. Once active, signblockscript becomes a BIP141 WSH scriptPubKey of the original signblockscript. All other dynamic parameters stay constant.(default: -1, which means ACTIVE from genesis)", ArgsManager::ALLOW_ANY, OptionsCategory::ELEMENTS);
|
||||
argsman.AddArg("-con_dyna_deploy_signal", "Whether to signal for the Dynamic Federations deployment (default: false).", ArgsManager::ALLOW_ANY, OptionsCategory::ELEMENTS);
|
||||
argsman.AddArg("-con_dyna_deploy_signal", "Whether to signal for the Dynamic Federations deployment (default: true).", ArgsManager::ALLOW_ANY, OptionsCategory::ELEMENTS);
|
||||
argsman.AddArg("-dynamic_epoch_length", "Per-chain parameter that sets how many blocks dynamic federation voting and enforcement are in effect for.", ArgsManager::ALLOW_ANY, OptionsCategory::ELEMENTS);
|
||||
argsman.AddArg("-total_valid_epochs", "Per-chain parameter that sets how long a particular fedpegscript is in effect for.", ArgsManager::ALLOW_ANY, OptionsCategory::ELEMENTS);
|
||||
argsman.AddArg("-con_taproot_signal_start", "Whether, and at what blockheight, to start signalling for Taproot activation (default: false) (regtest, Liquid testnet, or custom only).", ArgsManager::ALLOW_ANY, OptionsCategory::ELEMENTS);
|
||||
argsman.AddArg("-evbparams=deployment:start:end:period:threshold", "Use given start/end times for specified version bits deployment (regtest or custom only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::ELEMENTS);
|
||||
// END ELEMENTS
|
||||
//
|
||||
}
|
||||
|
|
|
|||
|
|
@ -158,19 +158,20 @@ bool IsConfirmedBitcoinBlock(const uint256& hash, const int nMinConfirmationDept
|
|||
UniValue params(UniValue::VARR);
|
||||
params.push_back(hash.GetHex());
|
||||
UniValue reply = CallMainChainRPC("getblockheader", params);
|
||||
if (!find_value(reply, "error").isNull()) {
|
||||
LogPrintf("ERROR: Got error reply from bitcoind getblockheader.\n");
|
||||
UniValue errval = find_value(reply, "error");
|
||||
if (!errval.isNull()) {
|
||||
LogPrintf("WARNING: Got error reply from bitcoind getblockheader: %s\n", errval.write());
|
||||
return false;
|
||||
}
|
||||
UniValue result = find_value(reply, "result");
|
||||
if (!result.isObject()) {
|
||||
LogPrintf("ERROR: bitcoind getblockheader result was malformed (not object).\n");
|
||||
LogPrintf("ERROR: bitcoind getblockheader result was malformed (not object): %s\n", result.write());
|
||||
return false;
|
||||
}
|
||||
|
||||
UniValue confirmations = find_value(result.get_obj(), "confirmations");
|
||||
if (!confirmations.isNum() || confirmations.get_int64() < nMinConfirmationDepth) {
|
||||
LogPrintf("Insufficient confirmations (got %s).\n", confirmations.write());
|
||||
LogPrintf("Insufficient confirmations (got %s, need at least %d).\n", confirmations.write(), nMinConfirmationDepth);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -178,16 +179,16 @@ bool IsConfirmedBitcoinBlock(const uint256& hash, const int nMinConfirmationDept
|
|||
if (nbTxs != 0) {
|
||||
UniValue nTx = find_value(result.get_obj(), "nTx");
|
||||
if (!nTx.isNum() || nTx.get_int64() != nbTxs) {
|
||||
LogPrintf("ERROR: Invalid number of transactions in merkle block for %s\n",
|
||||
hash.GetHex());
|
||||
LogPrintf("ERROR: Invalid number of transactions in merkle block for %s (got %s, need exactly %d)\n",
|
||||
hash.GetHex(), nTx.write(), nbTxs);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} catch (CConnectionFailed& e) {
|
||||
LogPrintf("ERROR: Lost connection to mainchain daemon RPC, you will want to restart after fixing this!\n");
|
||||
LogPrintf("WARNING: Lost connection to mainchain daemon RPC; will retry.\n");
|
||||
return false;
|
||||
} catch (...) {
|
||||
LogPrintf("ERROR: Failure connecting to mainchain daemon RPC, you will want to restart after fixing this!\n");
|
||||
LogPrintf("WARNING: Failure connecting to mainchain daemon RPC; will retry.\n");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -1843,7 +1843,8 @@ void PeerManager::ProcessHeadersMessage(CNode& pfrom, const std::vector<CBlockHe
|
|||
}
|
||||
|
||||
BlockValidationState state;
|
||||
if (!m_chainman.ProcessNewBlockHeaders(headers, state, m_chainparams, &pindexLast)) {
|
||||
bool all_duplicate = false;
|
||||
if (!m_chainman.ProcessNewBlockHeaders(headers, state, m_chainparams, &pindexLast, &all_duplicate)) {
|
||||
if (state.IsInvalid()) {
|
||||
MaybePunishNodeForBlock(pfrom.GetId(), state, via_compact_block, "invalid header received");
|
||||
return;
|
||||
|
|
@ -1869,10 +1870,11 @@ void PeerManager::ProcessHeadersMessage(CNode& pfrom, const std::vector<CBlockHe
|
|||
nodestate->m_last_block_announcement = GetTime();
|
||||
}
|
||||
|
||||
if (nCount == MAX_HEADERS_RESULTS) {
|
||||
if (nCount == MAX_HEADERS_RESULTS && !all_duplicate) {
|
||||
// Headers message had its maximum size; the peer may have more headers.
|
||||
// TODO: optimize: if pindexLast is an ancestor of ::ChainActive().Tip or pindexBestHeader, continue
|
||||
// from there instead.
|
||||
// HOWEVER, if all headers we got this time were duplicates that we already had, don't ask for any more.
|
||||
LogPrint(BCLog::NET, "more getheaders (%d) to end to peer=%d (startheight:%d)\n", pindexLast->nHeight, pfrom.GetId(), pfrom.nStartingHeight);
|
||||
m_connman.PushMessage(&pfrom, msgMaker.Make(NetMsgType::GETHEADERS, ::ChainActive().GetLocator(pindexLast), uint256()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -373,7 +373,6 @@ bool IsValidPeginWitness(const CScriptWitness& pegin_witness, const std::vector<
|
|||
if (tx_index == 0) {
|
||||
required_depth = std::max(required_depth, (unsigned int)COINBASE_MATURITY);
|
||||
}
|
||||
LogPrintf("Required depth: %d\n", required_depth);
|
||||
if (!IsConfirmedBitcoinBlock(block_hash, required_depth, num_txs)) {
|
||||
err_msg = "Needs more confirmations.";
|
||||
if (depth_failed) {
|
||||
|
|
|
|||
|
|
@ -405,9 +405,9 @@ static RPCHelpMan createrawtransaction()
|
|||
{"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The transaction id"},
|
||||
{"vout", RPCArg::Type::NUM, RPCArg::Optional::NO, "The output number"},
|
||||
{"sequence", RPCArg::Type::NUM, /* default */ "depends on the value of the 'replaceable' and 'locktime' arguments", "The sequence number"},
|
||||
{"pegin_bitcoin_tx", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The raw bitcoin transaction (in hex) depositing bitcoin to the mainchain_address generated by getpeginaddress"},
|
||||
{"pegin_txout_proof", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "A rawtxoutproof (in hex) generated by the mainchain daemon's `gettxoutproof` containing a proof of only bitcoin_tx"},
|
||||
{"pegin_claim_script", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The claim script generated by getpeginaddress."},
|
||||
{"pegin_bitcoin_tx", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED_NAMED_ARG, "(only for pegin inputs) The raw bitcoin transaction (in hex) depositing bitcoin to the mainchain_address generated by getpeginaddress"},
|
||||
{"pegin_txout_proof", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED_NAMED_ARG, "(only for pegin inputs) A rawtxoutproof (in hex) generated by the mainchain daemon's `gettxoutproof` containing a proof of only bitcoin_tx"},
|
||||
{"pegin_claim_script", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED_NAMED_ARG, "(only for pegin inputs) The claim script generated by getpeginaddress."},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1981,8 +1981,7 @@ int32_t ComputeBlockVersion(const CBlockIndex* pindexPrev, const Consensus::Para
|
|||
}
|
||||
}
|
||||
|
||||
// Undo default signalling behavior for dynafed unless explicitly enabled.
|
||||
if (!gArgs.GetBoolArg("-con_dyna_deploy_signal", false)) {
|
||||
if (!gArgs.GetBoolArg("-con_dyna_deploy_signal", true)) {
|
||||
auto dynafed = Consensus::DeploymentPos::DEPLOYMENT_DYNA_FED;
|
||||
int bit = params.vDeployments[dynafed].bit;
|
||||
if (bit > 0 && bit < VERSIONBITS_NUM_BITS) {
|
||||
|
|
@ -4036,16 +4035,22 @@ static bool ContextualCheckBlock(const CBlock& block, BlockValidationState& stat
|
|||
return true;
|
||||
}
|
||||
|
||||
bool BlockManager::AcceptBlockHeader(const CBlockHeader& block, BlockValidationState& state, const CChainParams& chainparams, CBlockIndex** ppindex)
|
||||
bool BlockManager::AcceptBlockHeader(const CBlockHeader& block, BlockValidationState& state, const CChainParams& chainparams, CBlockIndex** ppindex, bool* duplicate)
|
||||
{
|
||||
AssertLockHeld(cs_main);
|
||||
// Check for duplicate
|
||||
uint256 hash = block.GetHash();
|
||||
BlockMap::iterator miSelf = m_block_index.find(hash);
|
||||
CBlockIndex *pindex = nullptr;
|
||||
if (duplicate) {
|
||||
*duplicate = false;
|
||||
}
|
||||
if (hash != chainparams.GetConsensus().hashGenesisBlock) {
|
||||
if (miSelf != m_block_index.end()) {
|
||||
// Block header is already known.
|
||||
if (duplicate) {
|
||||
*duplicate = true;
|
||||
}
|
||||
pindex = miSelf->second;
|
||||
if (ppindex)
|
||||
*ppindex = pindex;
|
||||
|
|
@ -4125,17 +4130,24 @@ bool BlockManager::AcceptBlockHeader(const CBlockHeader& block, BlockValidationS
|
|||
}
|
||||
|
||||
// Exposed wrapper for AcceptBlockHeader
|
||||
bool ChainstateManager::ProcessNewBlockHeaders(const std::vector<CBlockHeader>& headers, BlockValidationState& state, const CChainParams& chainparams, const CBlockIndex** ppindex)
|
||||
bool ChainstateManager::ProcessNewBlockHeaders(const std::vector<CBlockHeader>& headers, BlockValidationState& state, const CChainParams& chainparams, const CBlockIndex** ppindex, bool* all_duplicate)
|
||||
{
|
||||
AssertLockNotHeld(cs_main);
|
||||
{
|
||||
LOCK(cs_main);
|
||||
if (all_duplicate) {
|
||||
*all_duplicate = true;
|
||||
}
|
||||
bool duplicate = false;
|
||||
for (const CBlockHeader& header : headers) {
|
||||
CBlockIndex *pindex = nullptr; // Use a temp pindex instead of ppindex to avoid a const_cast
|
||||
bool accepted = m_blockman.AcceptBlockHeader(
|
||||
header, state, chainparams, &pindex);
|
||||
header, state, chainparams, &pindex, &duplicate);
|
||||
::ChainstateActive().CheckBlockIndex(chainparams.GetConsensus());
|
||||
|
||||
if (all_duplicate) {
|
||||
(*all_duplicate) &= duplicate; // False if any are false
|
||||
}
|
||||
if (!accepted) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -440,7 +440,8 @@ public:
|
|||
const CBlockHeader& block,
|
||||
BlockValidationState& state,
|
||||
const CChainParams& chainparams,
|
||||
CBlockIndex** ppindex) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
||||
CBlockIndex** ppindex,
|
||||
bool* duplicate = nullptr) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
||||
|
||||
~BlockManager() {
|
||||
Unload();
|
||||
|
|
@ -926,7 +927,7 @@ public:
|
|||
* @param[in] chainparams The params for the chain we want to connect to
|
||||
* @param[out] ppindex If set, the pointer will be set to point to the last new block index object for the given headers
|
||||
*/
|
||||
bool ProcessNewBlockHeaders(const std::vector<CBlockHeader>& block, BlockValidationState& state, const CChainParams& chainparams, const CBlockIndex** ppindex = nullptr) LOCKS_EXCLUDED(cs_main);
|
||||
bool ProcessNewBlockHeaders(const std::vector<CBlockHeader>& block, BlockValidationState& state, const CChainParams& chainparams, const CBlockIndex** ppindex = nullptr, bool* all_duplicate = nullptr) LOCKS_EXCLUDED(cs_main);
|
||||
|
||||
//! Load the block tree and coins database from disk, initializing state if we're running with -reindex
|
||||
bool LoadBlockIndex(const CChainParams& chainparams) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
||||
|
|
|
|||
|
|
@ -5670,7 +5670,7 @@ static RPCHelpMan sendtomainchain_pak()
|
|||
|
||||
FlatSigningProvider provider;
|
||||
std::string error;
|
||||
const auto descriptor = Parse(pwallet->offline_desc, provider, error);
|
||||
auto descriptor = Parse(pwallet->offline_desc, provider, error);
|
||||
|
||||
LegacyScriptPubKeyMan* spk_man = pwallet->GetLegacyScriptPubKeyMan();
|
||||
if (!spk_man) {
|
||||
|
|
@ -5683,6 +5683,11 @@ static RPCHelpMan sendtomainchain_pak()
|
|||
if (!pwallet->SetOfflineDescriptor(offline_desc)) {
|
||||
throw JSONRPCError(RPC_WALLET_ERROR, "Couldn't set wallet descriptor for peg-outs.");
|
||||
}
|
||||
|
||||
descriptor = Parse(pwallet->offline_desc, provider, error);
|
||||
if (!descriptor) {
|
||||
throw JSONRPCError(RPC_WALLET_ERROR, "descriptor still null. This is a bug in elementsd.");
|
||||
}
|
||||
}
|
||||
|
||||
std::string desc_str = pwallet->offline_desc;
|
||||
|
|
|
|||
|
|
@ -322,7 +322,7 @@ def initialize_datadir(dirname, n):
|
|||
f.write("pubkeyprefix=111\n")
|
||||
f.write("scriptprefix=196\n")
|
||||
f.write("bech32_hrp=bcrt\n")
|
||||
f.write("con_dyna_deploy_start="+str(2**31)+"\n") # Never starts
|
||||
f.write("evbparams=dynafed:"+str(2**31)+":::\n") # Never starts
|
||||
f.write("minrelaytxfee=0.00001\n")
|
||||
os.makedirs(os.path.join(datadir, 'stderr'), exist_ok=True)
|
||||
os.makedirs(os.path.join(datadir, 'stdout'), exist_ok=True)
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ class BlockSignTest(BitcoinTestFramework):
|
|||
"-signblockscript={}".format(signblockscript),
|
||||
"-con_max_block_sig_size={}".format(self.required_signers*74+self.num_nodes*33),
|
||||
"-anyonecanspendaremine=1",
|
||||
"-con_dyna_deploy_start=0",
|
||||
"-evbparams=dynafed:0:::",
|
||||
"-con_dyna_deploy_signal=1",
|
||||
]] * self.num_nodes
|
||||
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ class DynaFedTest(BitcoinTestFramework):
|
|||
self.num_nodes = 2
|
||||
# We want to test activation of dynafed
|
||||
self.extra_args = [[
|
||||
"-con_dyna_deploy_start=1000",
|
||||
"-evbparams=dynafed:1000:::",
|
||||
"-enforce_pak=1",
|
||||
"-con_parent_chain_signblockscript=51",
|
||||
"-peginconfirmationdepth=1",
|
||||
|
|
@ -78,7 +78,7 @@ class DynaFedTest(BitcoinTestFramework):
|
|||
# second node will not mine transactions
|
||||
self.extra_args[1].append("-blocksonly=1")
|
||||
# Make sure nothing breaks if peers have a different activation.
|
||||
self.extra_args[1][0] = "-con_dyna_deploy_start=937"
|
||||
self.extra_args[1][0] = "-evbparams=dynafed:937:::"
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ class TaprootActivationTest(BitcoinTestFramework):
|
|||
assert_equal(rpc.getblockheader(blocks[0])["versionHex"], "20000000")
|
||||
|
||||
def run_test(self):
|
||||
# Test that regtest nodes without -con_taproot_signal_start never signal
|
||||
# Test that regtest nodes never signal taproot by default
|
||||
self.log.info("Testing node not configured to activate taproot")
|
||||
blocks = self.nodes[0].generatetoaddress(2500, self.nodes[0].getnewaddress())
|
||||
assert_equal(self.nodes[0].getblockcount(), 2500)
|
||||
|
|
@ -113,7 +113,7 @@ class TaprootActivationTest(BitcoinTestFramework):
|
|||
assert_equal (decode["versionHex"], "20000000")
|
||||
|
||||
# Test activation starting from height 1000
|
||||
self.restart_node(0, ["-con_taproot_signal_start=500"])
|
||||
self.restart_node(0, ["-evbparams=taproot:500:::"])
|
||||
self.nodes[0].invalidateblock(self.nodes[0].getblockhash(1))
|
||||
self.test_activation(self.nodes[0], 500)
|
||||
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ class FedPegTest(BitcoinTestFramework):
|
|||
|
||||
# Immediate activation of dynafed when requested versus "never" from conf
|
||||
if self.options.pre_transition or self.options.post_transition:
|
||||
extra_args.extend(["-con_dyna_deploy_start=-1"])
|
||||
extra_args.extend(["-evbparams=dynafed:-1:::"])
|
||||
|
||||
# Use rpcuser auth only for first parent.
|
||||
if n==0:
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class PAKTest (BitcoinTestFramework):
|
|||
def set_test_params(self):
|
||||
self.num_nodes = 3
|
||||
self.setup_clean_chain = True
|
||||
self.extra_args = [["-enforce_pak=1", "-con_dyna_deploy_start=-1", "-initialfreecoins=210000000000000", "-anyonecanspendaremine=1", "-parent_bech32_hrp=lol", "-pubkeyprefix=112", "-scriptprefix=197", "-con_connect_genesis_outputs=1"] for i in range(self.num_nodes)]
|
||||
self.extra_args = [["-enforce_pak=1", "-evbparams=dynafed:-1:::", "-initialfreecoins=210000000000000", "-anyonecanspendaremine=1", "-parent_bech32_hrp=lol", "-pubkeyprefix=112", "-scriptprefix=197", "-con_connect_genesis_outputs=1"] for i in range(self.num_nodes)]
|
||||
# First node doesn't enforce PAK, a "HF" of the other two nodes
|
||||
self.extra_args[0] = ["-acceptnonstdtxn=1"] + self.extra_args[0][1:] ## FIXME -acceptnonstdtxn=1 should not be needed
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class SighashRangeproofTest(BitcoinTestFramework):
|
|||
self.num_nodes = 3
|
||||
# We want to test activation of dynafed
|
||||
self.extra_args = [[
|
||||
"-con_dyna_deploy_start=1000",
|
||||
"-evbparams=dynafed:1000:::",
|
||||
"-con_dyna_deploy_signal=1",
|
||||
"-blindedaddresses=1",
|
||||
"-initialfreecoins=2100000000000000",
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class TweakFedpegTest(BitcoinTestFramework):
|
|||
[
|
||||
"-fedpegscript="+LIQUID_SCRIPT,
|
||||
"-con_dyna_deploy_signal=1",
|
||||
"-con_dyna_deploy_start=0", # test dynafed derivation
|
||||
"-evbparams=dynafed:0:::", # test dynafed derivation
|
||||
]]
|
||||
|
||||
def setup_network(self):
|
||||
|
|
|
|||
|
|
@ -381,7 +381,7 @@ def initialize_datadir(dirname, n, chain):
|
|||
f.write("con_bip65height=1351\n")
|
||||
f.write("con_bip66height=1251\n")
|
||||
f.write("blindedaddresses=0\n") # Set to minimize broken tests in favor of custom
|
||||
f.write("con_dyna_deploy_start="+str(2**31)+"\n") # Never starts unless overridden
|
||||
f.write("evbparams=dynafed:"+str(2**31)+":::\n") # Never starts unless overridden
|
||||
f.write("minrelaytxfee=0.00001\n")
|
||||
#f.write("pubkeyprefix=111\n")
|
||||
#f.write("scriptprefix=196\n")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue