Skip to content

Commit

Permalink
Implement -foundationsidestakeallocation for testing
Browse files Browse the repository at this point in the history
Also modify FoundationSideStakeAddress()
  • Loading branch information
jamescowens committed Mar 14, 2022
1 parent 94ee7fe commit 962999c
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,7 @@ void SetupServerArgs()
// Temporary for block v12 testing
hidden_args.emplace_back("-blockv12height");
hidden_args.emplace_back("-foundationaddress");
hidden_args.emplace_back("-foundationsidestakeallocation");

// -boinckey should now be removed entirely. It is put here to prevent the executable erroring out on
// an invalid parameter for old clients that may have left the argument in.
Expand Down
38 changes: 32 additions & 6 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -912,21 +912,47 @@ unsigned int GetCoinstakeOutputLimit(const int& block_version)
}

Fraction FoundationSideStakeAllocation() {
// stub

// TODO: implement protocol section based override with default value as below.

return Fraction(1, 20);
if (fTestNet) {
std::vector<std::string> fraction = split(gArgs.GetArg("-foundationsidestakeallocation", "4/5"), "/");

int64_t numerator = 0;
int64_t denominator = 0;

if (fraction.size() == 2
&& ParseInt64(fraction[0], &numerator)
&& ParseInt64(fraction[1], &denominator)
&& numerator > 0
&& denominator > 0) {
return Fraction(numerator, denominator);
}
}

// Will get here if either not on testnet OR on testnet and there is no valid foundationsidestakeallocation.
return Fraction(4, 5);
}

CBitcoinAddress FoundationSideStakeAddress() {
// stub

// TODO: implement protocol section based override with default value as below.

CBitcoinAddress foundation_address(gArgs.GetArg("-foundationaddress" ,"bc3NA8e8E3EoTL1qhRmeprbjWcmuoZ26A2"));
CBitcoinAddress foundation_address;

// If on testnet and not overridden, set foundation destination address to test wallet address
if (fTestNet) {
if (foundation_address.SetString(gArgs.GetArg("-foundationaddress" ,"mfiy9sc2QEZZCK3WMUMZjNfrdRA6gXzRhr"))) {
} else {
foundation_address.SetString("mfiy9sc2QEZZCK3WMUMZjNfrdRA6gXzRhr");
}

return foundation_address;
}

// Will get here if not on testnet.
foundation_address.SetString("bc3NA8e8E3EoTL1qhRmeprbjWcmuoZ26A2");

return foundation_address;
;
}

unsigned int GetMRCOutputLimit(const int& block_version, bool include_foundation_sidestake)
Expand Down

0 comments on commit 962999c

Please sign in to comment.