Skip to content

Commit 04d0691

Browse files
committed
Rename con_elementswitness to con_elementsmode
It will have effect on more than just witness structure from now on.
1 parent 484d83c commit 04d0691

File tree

11 files changed

+23
-23
lines changed

11 files changed

+23
-23
lines changed

src/chainparams.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ class CMainParams : public CChainParams {
151151
multi_data_permitted = false;
152152
consensus.has_parent_chain = false;
153153
g_signed_blocks = false;
154-
g_con_elementswitness = false;
154+
g_con_elementsmode = false;
155155
g_con_blockheightinheader = false;
156156

157157
/**
@@ -277,7 +277,7 @@ class CTestNetParams : public CChainParams {
277277
multi_data_permitted = false;
278278
consensus.has_parent_chain = false;
279279
g_signed_blocks = false;
280-
g_con_elementswitness = false;
280+
g_con_elementsmode = false;
281281
g_con_blockheightinheader = false;
282282

283283
pchMessageStart[0] = 0x0b;
@@ -378,7 +378,7 @@ class CRegTestParams : public CChainParams {
378378
multi_data_permitted = false;
379379
consensus.has_parent_chain = false;
380380
g_signed_blocks = false;
381-
g_con_elementswitness = false;
381+
g_con_elementsmode = false;
382382
g_con_blockheightinheader = false;
383383

384384
pchMessageStart[0] = 0xfa;
@@ -543,7 +543,7 @@ class CCustomParams : public CRegTestParams {
543543
// Note: These globals are needed to avoid circular dependencies.
544544
// Default to true for custom chains.
545545
g_con_blockheightinheader = args.GetBoolArg("-con_blockheightinheader", true);
546-
g_con_elementswitness = args.GetBoolArg("-con_elementswitness", true);
546+
g_con_elementsmode = args.GetBoolArg("-con_elementsmode", true);
547547

548548
// No subsidy for custom chains by default
549549
consensus.genesis_subsidy = args.GetArg("-con_blocksubsidy", 0);
@@ -591,7 +591,7 @@ class CCustomParams : public CRegTestParams {
591591
GenerateAssetEntropy(entropy, COutPoint(uint256(commit), 0), parentGenesisBlockHash);
592592

593593
// Elements serialization uses derivation, bitcoin serialization uses 0x00
594-
if (g_con_elementswitness) {
594+
if (g_con_elementsmode) {
595595
CalculateAsset(consensus.pegged_asset, entropy);
596596
} else {
597597
assert(consensus.pegged_asset == CAsset());
@@ -712,7 +712,7 @@ class CLiquidV1Params : public CChainParams {
712712
g_signed_blocks = true;
713713

714714
g_con_blockheightinheader = true;
715-
g_con_elementswitness = true;
715+
g_con_elementsmode = true;
716716

717717
consensus.genesis_subsidy = 0;
718718

@@ -750,7 +750,7 @@ class CLiquidV1Params : public CChainParams {
750750
GenerateAssetEntropy(entropy, COutPoint(uint256(commit), 0), parentGenesisBlockHash);
751751

752752
// Elements serialization uses derivation, bitcoin serialization uses 0x00
753-
if (g_con_elementswitness) {
753+
if (g_con_elementsmode) {
754754
CalculateAsset(consensus.pegged_asset, entropy);
755755
} else {
756756
assert(consensus.pegged_asset == CAsset());

src/chainparamsbase.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ void SetupChainParamsBaseOptions()
2727
gArgs.AddArg("-con_mandatorycoinbase", "All non-zero valued coinbase outputs must go to this scriptPubKey, if set.", false, OptionsCategory::ELEMENTS);
2828
gArgs.AddArg("-con_blocksubsidy", "Defines the amount of block subsidy to start with, at genesis block.", false, OptionsCategory::ELEMENTS);
2929
gArgs.AddArg("-con_connect_coinbase", "Connect outputs in genesis block to utxo database.", false, OptionsCategory::ELEMENTS);
30-
gArgs.AddArg("-con_elementswitness", "Use Elements-like instead of Core-like witness encoding. This is required for CA/CT. (default: true)", false, OptionsCategory::ELEMENTS);
30+
gArgs.AddArg("-con_elementsmode", "Use Elements-like instead of Core-like witness encoding. This is required for CA/CT. (default: true)", false, OptionsCategory::ELEMENTS);
3131
gArgs.AddArg("-con_blockheightinheader", "Whether the chain includes the block height directly in the header, for easier validation of block height in low-resource environments. (default: true)", false, OptionsCategory::CHAINPARAMS);
3232
gArgs.AddArg("-con_genesis_style=<style>", "Use genesis style <style> (default: elements). Results in genesis block compatibility with various networks. Allowed values: elements, bitcoin", true, OptionsCategory::ELEMENTS);
3333
gArgs.AddArg("-con_signed_blocks", "Signed blockchain. Uses input of `-signblockscript` to define what signatures are necessary to solve it.", false, OptionsCategory::CHAINPARAMS);

src/consensus/merkle.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ uint256 BlockWitnessMerkleRoot(const CBlock& block, bool* mutated)
7979
leaves.resize(block.vtx.size());
8080
leaves[0].SetNull(); // The witness hash of the coinbase is 0.
8181
for (size_t s = 1; s < block.vtx.size(); s++) {
82-
if (g_con_elementswitness) {
82+
if (g_con_elementsmode) {
8383
leaves[s] = block.vtx[s]->GetWitnessOnlyHash();
8484
} else {
8585
leaves[s] = block.vtx[s]->GetWitnessHash();

src/consensus/validation.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ static inline int64_t GetTransactionInputWeight(const CTransaction& tx, const si
108108
{
109109
// scriptWitness size is added here because witnesses and txins are split up in segwit serialization.
110110
assert(tx.witness.vtxinwit.size() > nIn);
111-
//TODO(rebase) only count CA/CT witnesses when g_con_elementswitness is true
111+
//TODO(rebase) only count CA/CT witnesses when g_con_elementsmode is true
112112
return ::GetSerializeSize(tx.vin[nIn], PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS) * (WITNESS_SCALE_FACTOR - 1)
113113
+ ::GetSerializeSize(tx.vin[nIn], PROTOCOL_VERSION)
114114
+ ::GetSerializeSize(tx.witness.vtxinwit[nIn].scriptWitness.stack, PROTOCOL_VERSION)

src/core_write.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ void TxToUniv(const CTransaction& tx, const uint256& hashBlock, UniValue& entry,
200200
{
201201
entry.pushKV("txid", tx.GetHash().GetHex());
202202
entry.pushKV("hash", tx.GetWitnessHash().GetHex());
203-
if (g_con_elementswitness) {
203+
if (g_con_elementsmode) {
204204
entry.pushKV("wtxid", tx.GetWitnessHash().GetHex());
205205
entry.pushKV("withash", tx.GetWitnessOnlyHash().GetHex());
206206
}

src/init.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ void SetupServerArgs()
513513
gArgs.AddArg("-blech32_hrp", strprintf("The human-readable part of the chain's blech32 encoding. Used in confidential addresses.(default: %s)", defaultChainParams->Blech32HRP()), false, OptionsCategory::CHAINPARAMS);
514514
gArgs.AddArg("-assetdir", "Entries of pet names of assets, in this format:asset=<hex>:<label>. There can be any number of entries.", false, OptionsCategory::ELEMENTS);
515515
gArgs.AddArg("-defaultpeggedassetname", "Default name of the pegged asset. (default: bitcoin)", false, OptionsCategory::ELEMENTS);
516-
gArgs.AddArg("-blindedaddresses", "Give blind addresses by default via getnewaddress and getrawchangeaddress. (default: -con_elementswitness value)", false, OptionsCategory::ELEMENTS);
516+
gArgs.AddArg("-blindedaddresses", "Give blind addresses by default via getnewaddress and getrawchangeaddress. (default: -con_elementsmode value)", false, OptionsCategory::ELEMENTS);
517517

518518
#if HAVE_DECL_DAEMON
519519
gArgs.AddArg("-daemon", "Run in the background as a daemon and accept commands", false, OptionsCategory::OPTIONS);

src/primitives/confidential.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include <uint256.h>
1111
#include <utilstrencodings.h>
1212

13-
extern bool g_con_elementswitness;
13+
extern bool g_con_elementsmode;
1414

1515
/**
1616
* Confidential assets, values, and nonces all share enough code in common
@@ -104,7 +104,7 @@ class CConfidentialAsset : public CConfidentialCommitment<33, 10, 11>
104104
vchCommitment.clear();
105105

106106
// Set to dummy asset when not doing CA.
107-
if (!g_con_elementswitness) {
107+
if (!g_con_elementsmode) {
108108
SetToAsset(CAsset());
109109
}
110110
}
@@ -133,7 +133,7 @@ class CConfidentialValue : public CConfidentialCommitment<9, 8, 9>
133133
* a 64-bit big-endian integer. */
134134
CAmount GetAmount() const
135135
{
136-
if (!g_con_elementswitness && IsNull()) {
136+
if (!g_con_elementsmode && IsNull()) {
137137
return -1;
138138
}
139139

src/primitives/transaction.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <tinyformat.h>
1010
#include <utilstrencodings.h>
1111

12-
bool g_con_elementswitness = false;
12+
bool g_con_elementsmode = false;
1313

1414
std::string COutPoint::ToString() const
1515
{
@@ -83,7 +83,7 @@ uint256 CTransaction::ComputeWitnessHash() const
8383
// ELEMENTS ONLY
8484
uint256 CTransaction::GetWitnessOnlyHash() const
8585
{
86-
assert(g_con_elementswitness);
86+
assert(g_con_elementsmode);
8787

8888
std::vector<uint256> leaves;
8989
leaves.reserve(std::max(vin.size(), vout.size()));

src/primitives/transaction.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ static const int SERIALIZE_TRANSACTION_NO_WITNESS = 0x40000000;
1818

1919
// ELEMENTS:
2020
// Globals to avoid circular dependencies.
21-
extern bool g_con_elementswitness;
21+
extern bool g_con_elementsmode;
2222

2323
/** An outpoint - a combination of a transaction hash and an index n into its vout */
2424
class COutPoint
@@ -310,7 +310,7 @@ inline void UnserializeTransaction(TxType& tx, Stream& s) {
310310

311311
// Witness serialization is different between Elements and Core.
312312
// See code comments in SerializeTransaction for details about the differences.
313-
if (g_con_elementswitness) {
313+
if (g_con_elementsmode) {
314314
s >> flags;
315315
s >> tx.vin;
316316
s >> tx.vout;
@@ -378,7 +378,7 @@ inline void SerializeTransaction(const TxType& tx, Stream& s) {
378378
}
379379

380380
// Witness serialization is different between Elements and Core.
381-
if (g_con_elementswitness) {
381+
if (g_con_elementsmode) {
382382
// In Elements-style serialization, all normal data is serialized first and the
383383
// witnesses all in the end.
384384
s << flags;

src/wallet/rpcwallet.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ static UniValue getnewaddress(const JSONRPCRequest& request)
203203
}
204204
pwallet->LearnRelatedScripts(newKey, output_type);
205205
CTxDestination dest = GetDestinationForKey(newKey, output_type);
206-
if (g_con_elementswitness) {
206+
if (g_con_elementsmode) {
207207
CPubKey blinding_pubkey = pwallet->GetBlindingPubKey(GetScriptForDestination(dest));
208208
dest = GetDestinationForKey(newKey, output_type, blinding_pubkey);
209209
}
@@ -262,7 +262,7 @@ static UniValue getrawchangeaddress(const JSONRPCRequest& request)
262262

263263
pwallet->LearnRelatedScripts(vchPubKey, output_type);
264264
CTxDestination dest = GetDestinationForKey(vchPubKey, output_type);
265-
if (g_con_elementswitness) {
265+
if (g_con_elementsmode) {
266266
CPubKey blinding_pubkey = pwallet->GetBlindingPubKey(GetScriptForDestination(dest));
267267
dest = GetDestinationForKey(vchPubKey, output_type, blinding_pubkey);
268268
}

0 commit comments

Comments
 (0)