Skip to content

Commit b628d91

Browse files
committed
make peginconfirmationdepth a chain param
1 parent 89bcd1b commit b628d91

File tree

4 files changed

+4
-2
lines changed

4 files changed

+4
-2
lines changed

src/chainparams.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ class CCustomParams : public CChainParams {
129129
consensus.nMinimumChainWork = uint256S(GetArg("-con_nminimumchainwork", "0x00"));
130130
// By default assume that the signatures in ancestors of this block are valid.
131131
consensus.defaultAssumeValid = uint256S(GetArg("-con_defaultassumevalid", "0x00"));
132+
consensus.pegin_min_depth = GetArg("-peginconfirmationdepth", DEFAULT_PEGIN_CONFIRMATION_DEPTH);
132133
// bitcoin regtest is the parent chain by default
133134
parentGenesisBlockHash = uint256S(GetArg("-parentgenesisblockhash", "0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206"));
134135

src/consensus/params.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ struct Params {
6969
CScript fedpegScript;
7070
CAsset pegged_asset;
7171
uint256 defaultAssumeValid;
72+
uint32_t pegin_min_depth;
7273
};
7374
} // namespace Consensus
7475

src/validation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2474,7 +2474,7 @@ bool IsValidPeginWitness(const CScriptWitness& pegin_witness, const COutPoint& p
24742474

24752475
// Finally, validate peg-in via rpc call
24762476
if (check_depth && GetBoolArg("-validatepegin", DEFAULT_VALIDATE_PEGIN)) {
2477-
return IsConfirmedBitcoinBlock(merkle_block.header.GetHash(), GetArg("-peginconfirmationdepth", DEFAULT_PEGIN_CONFIRMATION_DEPTH));
2477+
return IsConfirmedBitcoinBlock(merkle_block.header.GetHash(), Params().GetConsensus().pegin_min_depth);
24782478
}
24792479
return true;
24802480
}

src/wallet/rpcwallet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3687,7 +3687,7 @@ UniValue createrawpegin(const JSONRPCRequest& request)
36873687

36883688
// Additional block lee-way to avoid bitcoin block races
36893689
if (GetBoolArg("-validatepegin", DEFAULT_VALIDATE_PEGIN)) {
3690-
ret.push_back(Pair("mature", IsConfirmedBitcoinBlock(merkleBlock.header.GetHash(), GetArg("-peginconfirmationdepth", DEFAULT_PEGIN_CONFIRMATION_DEPTH)+2)));
3690+
ret.push_back(Pair("mature", IsConfirmedBitcoinBlock(merkleBlock.header.GetHash(), Params().GetConsensus().pegin_min_depth+2)));
36913691
}
36923692

36933693
return ret;

0 commit comments

Comments
 (0)