| 726 | }; |
| 727 | |
| 728 | static void MaybeUpdateHeights(const ArgsManager& args, Consensus::Params& consensus) |
| 729 | { |
| 730 | for (const std::string& arg : args.GetArgs("-testactivationheight")) { |
| 731 | const auto found{arg.find('@')}; |
| 732 | if (found == std::string::npos) { |
| 733 | throw std::runtime_error(strprintf("Invalid format (%s) for -testactivationheight=name@height.", arg)); |
| 734 | } |
| 735 | const auto name{arg.substr(0, found)}; |
| 736 | const auto value{arg.substr(found + 1)}; |
| 737 | int32_t height; |
| 738 | if (!ParseInt32(value, &height) || height < 0 || height >= std::numeric_limits<int>::max()) { |
| 739 | throw std::runtime_error(strprintf("Invalid height value (%s) for -testactivationheight=name@height.", arg)); |
| 740 | } |
| 741 | if (name == "segwit") { |
| 742 | consensus.SegwitHeight = int{height}; |
| 743 | } else if (name == "bip34") { |
| 744 | consensus.BIP34Height = int{height}; |
| 745 | } else if (name == "dersig") { |
| 746 | consensus.BIP66Height = int{height}; |
| 747 | } else if (name == "cltv") { |
| 748 | consensus.BIP65Height = int{height}; |
| 749 | } else if (name == "csv") { |
| 750 | consensus.CSVHeight = int{height}; |
| 751 | } else { |
| 752 | throw std::runtime_error(strprintf("Invalid name (%s) for -testactivationheight=name@height.", arg)); |
| 753 | } |
| 754 | } |
| 755 | } |
| 756 | |
| 757 | void CRegTestParams::UpdateActivationParametersFromArgs(const ArgsManager& args) |
| 758 | { |
no test coverage detected