Skip to content

Commit 8a0d87a

Browse files
committed
Implement -foundationsidestakeallocation for testing
Also modify FoundationSideStakeAddress()
1 parent 94ee7fe commit 8a0d87a

File tree

2 files changed

+32
-6
lines changed

2 files changed

+32
-6
lines changed

src/init.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,7 @@ void SetupServerArgs()
560560
// Temporary for block v12 testing
561561
hidden_args.emplace_back("-blockv12height");
562562
hidden_args.emplace_back("-foundationaddress");
563+
hidden_args.emplace_back("-foundationsidestakeallocation");
563564

564565
// -boinckey should now be removed entirely. It is put here to prevent the executable erroring out on
565566
// an invalid parameter for old clients that may have left the argument in.

src/main.cpp

+31-6
Original file line numberDiff line numberDiff line change
@@ -912,21 +912,46 @@ unsigned int GetCoinstakeOutputLimit(const int& block_version)
912912
}
913913

914914
Fraction FoundationSideStakeAllocation() {
915-
// stub
916-
917915
// TODO: implement protocol section based override with default value as below.
918916

919-
return Fraction(1, 20);
917+
if (fTestNet) {
918+
std::vector<std::string> fraction = split(gArgs.GetArg("-foundationsidestakeallocation", "4/5"), "/");
919+
920+
int64_t numerator = 0;
921+
int64_t denominator = 0;
922+
923+
if (fraction.size() == 2
924+
&& ParseInt64(fraction[0], &numerator)
925+
&& ParseInt64(fraction[1], &denominator)
926+
&& numerator > 0
927+
&& denominator > 0) {
928+
return Fraction(numerator, denominator);
929+
}
930+
}
931+
932+
// Will get here if either not on testnet OR on testnet and there is no valid foundationsidestakeallocation.
933+
return Fraction(4, 5);
920934
}
921935

922936
CBitcoinAddress FoundationSideStakeAddress() {
923-
// stub
924-
925937
// TODO: implement protocol section based override with default value as below.
926938

927-
CBitcoinAddress foundation_address(gArgs.GetArg("-foundationaddress" ,"bc3NA8e8E3EoTL1qhRmeprbjWcmuoZ26A2"));
939+
CBitcoinAddress foundation_address;
940+
941+
// If on testnet and not overridden, set foundation destination address to test wallet address
942+
if (fTestNet) {
943+
if (!foundation_address.SetString(gArgs.GetArg("-foundationaddress" ,"mfiy9sc2QEZZCK3WMUMZjNfrdRA6gXzRhr"))) {
944+
foundation_address.SetString("mfiy9sc2QEZZCK3WMUMZjNfrdRA6gXzRhr");
945+
}
946+
947+
return foundation_address;
948+
}
949+
950+
// Will get here if not on testnet.
951+
foundation_address.SetString("bc3NA8e8E3EoTL1qhRmeprbjWcmuoZ26A2");
928952

929953
return foundation_address;
954+
;
930955
}
931956

932957
unsigned int GetMRCOutputLimit(const int& block_version, bool include_foundation_sidestake)

0 commit comments

Comments
 (0)