make peginconfirmationdepth a chain param

This commit is contained in:
Gregory Sanders 2018-03-28 11:40:20 -04:00
parent 89bcd1b5ba
commit b628d91894
4 changed files with 4 additions and 2 deletions

View file

@ -129,6 +129,7 @@ protected:
consensus.nMinimumChainWork = uint256S(GetArg("-con_nminimumchainwork", "0x00"));
// By default assume that the signatures in ancestors of this block are valid.
consensus.defaultAssumeValid = uint256S(GetArg("-con_defaultassumevalid", "0x00"));
consensus.pegin_min_depth = GetArg("-peginconfirmationdepth", DEFAULT_PEGIN_CONFIRMATION_DEPTH);
// bitcoin regtest is the parent chain by default
parentGenesisBlockHash = uint256S(GetArg("-parentgenesisblockhash", "0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206"));

View file

@ -69,6 +69,7 @@ struct Params {
CScript fedpegScript;
CAsset pegged_asset;
uint256 defaultAssumeValid;
uint32_t pegin_min_depth;
};
} // namespace Consensus

View file

@ -2474,7 +2474,7 @@ bool IsValidPeginWitness(const CScriptWitness& pegin_witness, const COutPoint& p
// Finally, validate peg-in via rpc call
if (check_depth && GetBoolArg("-validatepegin", DEFAULT_VALIDATE_PEGIN)) {
return IsConfirmedBitcoinBlock(merkle_block.header.GetHash(), GetArg("-peginconfirmationdepth", DEFAULT_PEGIN_CONFIRMATION_DEPTH));
return IsConfirmedBitcoinBlock(merkle_block.header.GetHash(), Params().GetConsensus().pegin_min_depth);
}
return true;
}

View file

@ -3687,7 +3687,7 @@ UniValue createrawpegin(const JSONRPCRequest& request)
// Additional block lee-way to avoid bitcoin block races
if (GetBoolArg("-validatepegin", DEFAULT_VALIDATE_PEGIN)) {
ret.push_back(Pair("mature", IsConfirmedBitcoinBlock(merkleBlock.header.GetHash(), GetArg("-peginconfirmationdepth", DEFAULT_PEGIN_CONFIRMATION_DEPTH)+2)));
ret.push_back(Pair("mature", IsConfirmedBitcoinBlock(merkleBlock.header.GetHash(), Params().GetConsensus().pegin_min_depth+2)));
}
return ret;