Skip to content

Commit

Permalink
Merge pull request miketout#326 from VerusCoin/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Asherda authored May 8, 2021
2 parents 52b9976 + 1a105da commit 7b70e4c
Show file tree
Hide file tree
Showing 11 changed files with 98 additions and 58 deletions.
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ stages:
####START#### PROJECT LEVEL VARIABLES ####START####
########################################################################################################################
variables:
VERSION: 0.7.3
VERSION: 0.7.3-1
VERUS_CLI_ARM64_LINUX: Verus-CLI-Linux-v${VERSION}-arm64.tar.gz
VERUS_CLI_LINUX_X86_64: Verus-CLI-Linux-v${VERSION}-x86_64.tar.gz
VERUS_CLI_WINDOWS: Verus-CLI-Windows-v${VERSION}.zip
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## VerusCoin version 0.7.3
## VerusCoin version 0.7.3-1

Arguably the world's most advanced technology, zero knowledge privacy-centric blockchain, Verus Coin brings Sapling performance and zero knowledge features to an intelligent system with interchain smart contracts and a completely original, combined proof of stake/proof of work consensus algorithm that solves the nothing at stake problem. With this and its approach towards CPU mining and ASICs, Verus Coin strives to be one of the most naturally decentralizing and attack resistant blockchains in existence.

Expand Down
28 changes: 14 additions & 14 deletions contrib/seeds/nodes_test.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# List of fixed seed nodes for testnet

116.203.95.63:20902
159.69.55.214:20902
95.216.207.181:20902
192.46.230.10:20902
45.33.4.79:20902
185.25.48.236:20902
185.64.105.111:20902
116.203.95.63:29056
159.69.55.214:29056
95.216.207.181:29056
192.46.230.10:29056
45.33.4.79:29056
185.25.48.236:29056
185.64.105.111:29056

[2a01:4f8:c0c:f42e::1]:20902
[2a01:4f8:c010:2555::1]:20902
[2a01:4f9:c010:bbad::1]:20902
[2400:8901::f03c:92ff:fe44:9542]:20902
[2600:3c00::f03c:92ff:fe44:95b3]:20902
[2a04:2180:0:2::149]:20902
[2a04:2180:0:2::29]:20902
[2a01:4f8:c0c:f42e::1]:29056
[2a01:4f8:c010:2555::1]:29056
[2a01:4f9:c010:bbad::1]:29056
[2400:8901::f03c:92ff:fe44:9542]:29056
[2600:3c00::f03c:92ff:fe44:95b3]:29056
[2a04:2180:0:2::149]:29056
[2a04:2180:0:2::29]:29056
2 changes: 1 addition & 1 deletion doc/man/verus-cli/linux/README.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VerusCoin Command Line Tools v0.7.3
VerusCoin Command Line Tools v0.7.3-1

Contents:
verusd - VerusCoin daemon
Expand Down
2 changes: 1 addition & 1 deletion doc/man/verus-cli/mac/README.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VerusCoin Command Line Tools v0.7.3
VerusCoin Command Line Tools v0.7.3-1
Contents:
verusd - VerusCoin daemon.
verus - VerusCoin command line utility.
Expand Down
2 changes: 1 addition & 1 deletion doc/man/verus-cli/windows/README.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VerusCoin Command Line Tools v0.7.3
VerusCoin Command Line Tools v0.7.3-1
Contents:
verusd.exe - VerusCoin daemon
verus.exe - VerusCoin command line utility
Expand Down
28 changes: 14 additions & 14 deletions src/chainparamsseeds.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@ static SeedSpec6 pnSeed6_main[] = {
};

static SeedSpec6 pnSeed6_test[] = {
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x74,0xcb,0x5f,0x3f}, 20902},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x9f,0x45,0x37,0xd6}, 20902},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x5f,0xd8,0xcf,0xb5}, 20902},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xc0,0x2e,0xe6,0x0a}, 20902},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x2d,0x21,0x04,0x4f}, 20902},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xb9,0x19,0x30,0xec}, 20902},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xb9,0x40,0x69,0x6f}, 20902},
{{0x2a,0x01,0x04,0xf8,0x0c,0x0c,0xf4,0x2e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01}, 20902},
{{0x2a,0x01,0x04,0xf8,0xc0,0x10,0x25,0x55,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01}, 20902},
{{0x2a,0x01,0x04,0xf9,0xc0,0x10,0xbb,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01}, 20902},
{{0x24,0x00,0x89,0x01,0x00,0x00,0x00,0x00,0xf0,0x3c,0x92,0xff,0xfe,0x44,0x95,0x42}, 20902},
{{0x26,0x00,0x3c,0x00,0x00,0x00,0x00,0x00,0xf0,0x3c,0x92,0xff,0xfe,0x44,0x95,0xb3}, 20902},
{{0x2a,0x04,0x21,0x80,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x49}, 20902},
{{0x2a,0x04,0x21,0x80,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x29}, 20902}
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x74,0xcb,0x5f,0x3f}, 29056},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x9f,0x45,0x37,0xd6}, 29056},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x5f,0xd8,0xcf,0xb5}, 29056},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xc0,0x2e,0xe6,0x0a}, 29056},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x2d,0x21,0x04,0x4f}, 29056},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xb9,0x19,0x30,0xec}, 29056},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xb9,0x40,0x69,0x6f}, 29056},
{{0x2a,0x01,0x04,0xf8,0x0c,0x0c,0xf4,0x2e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01}, 29056},
{{0x2a,0x01,0x04,0xf8,0xc0,0x10,0x25,0x55,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01}, 29056},
{{0x2a,0x01,0x04,0xf9,0xc0,0x10,0xbb,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01}, 29056},
{{0x24,0x00,0x89,0x01,0x00,0x00,0x00,0x00,0xf0,0x3c,0x92,0xff,0xfe,0x44,0x95,0x42}, 29056},
{{0x26,0x00,0x3c,0x00,0x00,0x00,0x00,0x00,0xf0,0x3c,0x92,0xff,0xfe,0x44,0x95,0xb3}, 29056},
{{0x2a,0x04,0x21,0x80,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x49}, 29056},
{{0x2a,0x04,0x21,0x80,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x29}, 29056}
};
#endif // BITCOIN_CHAINPARAMSSEEDS_H
2 changes: 1 addition & 1 deletion src/komodo_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -1845,7 +1845,7 @@ void komodo_args(char *argv0)
mapArgs["-ac_supply"] = "5000000000000000";
mapArgs["-ac_eras"] = "1";
mapArgs["-ac_reward"] = "1200000000";
std::string halving = GetArg("-ac_halving", "2111111"); // this assignment is required for an ARM compiler workaround
std::string halving = GetArg("-ac_halving", "2111115"); // this assignment is required for an ARM compiler workaround
mapArgs["-ac_halving"] = halving; // allow testing easily with different values here
mapArgs["-ac_decay"] = "0";
mapArgs["-ac_options"] = "72"; // OPTION_ID_REFERRALS + OPTION_CANBERESERVE
Expand Down
2 changes: 1 addition & 1 deletion src/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ static const int MEMPOOL_GD_VERSION = 60002;
static const int NO_BLOOM_VERSION = 170004;

#define KOMODO_VERSION "0.2.1"
#define VERUS_VERSION "0.7.3"
#define VERUS_VERSION "0.7.3-1"

#endif // BITCOIN_VERSION_H
84 changes: 62 additions & 22 deletions src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5560,7 +5560,7 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, int nConfMine, int
return true;
}

bool CWallet::SelectCoins(const CAmount& nTargetValue, set<pair<const CWalletTx*,unsigned int> >& setCoinsRet, CAmount& nValueRet, bool& fOnlyProtectedCoinbaseCoinsRet, bool& fNeedProtectedCoinbaseCoinsRet, const CCoinControl* coinControl) const
bool CWallet::SelectCoins(const CAmount& nTargetValue, set<pair<const CWalletTx*,unsigned int> >& setCoinsRet, CAmount& nValueRet, CCurrencyValueMap &reserveChange, bool& fOnlyProtectedCoinbaseCoinsRet, bool& fNeedProtectedCoinbaseCoinsRet, const CCoinControl* coinControl) const
{
// Output parameter fOnlyProtectedCoinbaseCoinsRet is set to true when the only available coins are coinbase utxos.
uint64_t tmp; int32_t retval;
Expand Down Expand Up @@ -5610,6 +5610,7 @@ bool CWallet::SelectCoins(const CAmount& nTargetValue, set<pair<const CWalletTx*
if (!out.fSpendable)
continue;
nValueRet += out.tx->vout[out.i].nValue;
reserveChange += out.tx->vout[out.i].ReserveOutValue();
//if ( KOMODO_EXCHANGEWALLET == 0 )
// *interestp += out.tx->vout[out.i].interest;
setCoinsRet.insert(make_pair(out.tx, out.i));
Expand Down Expand Up @@ -5657,8 +5658,16 @@ bool CWallet::SelectCoins(const CAmount& nTargetValue, set<pair<const CWalletTx*
retval = true;
else if ( bSpendZeroConfChange && SelectCoinsMinConf(nTargetValue, 0, 1, vCoins, setCoinsRet, nValueRet) != 0 )
retval = true;

// because SelectCoinsMinConf clears the setCoinsRet, we now add the possible inputs to the coinset
setCoinsRet.insert(setPresetCoins.begin(), setPresetCoins.end());

// return the total reserve, which will all be change, since this is used by native-only aware code
for (auto &oneOut : setCoinsRet)
{
reserveChange += oneOut.first->vout[oneOut.second].ReserveOutValue();
}

// add preset inputs to the total value selected
nValueRet += nValueFromPresetInputs;
return retval;
Expand Down Expand Up @@ -6365,7 +6374,8 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
bool fOnlyProtectedCoinbaseCoins = false;
bool fNeedProtectedCoinbaseCoins = false;
interest2 = 0;
if (!SelectCoins(nTotalValue, setCoins, nValueIn, fOnlyProtectedCoinbaseCoins, fNeedProtectedCoinbaseCoins, coinControl))
CCurrencyValueMap reserveChange;
if (!SelectCoins(nTotalValue, setCoins, nValueIn, reserveChange, fOnlyProtectedCoinbaseCoins, fNeedProtectedCoinbaseCoins, coinControl))
{
if (fOnlyProtectedCoinbaseCoins) {
strFailReason = _("Coinbase funds earned while shielding protection is active can only be sent to a zaddr");
Expand Down Expand Up @@ -6413,7 +6423,8 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
if (nSubtractFeeFromAmount == 0)
nChange -= nFeeRet;

if (nChange > 0)
CCurrencyValueMap nullCurrencyMap;
if (reserveChange > nullCurrencyMap || nChange > 0)
{
// Fill a vout to ourself
// TODO: pass in scriptChange instead of reservekey so
Expand All @@ -6422,8 +6433,21 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt

// coin control: send change to custom address
if (coinControl && !boost::get<CNoDestination>(&coinControl->destChange))
scriptChange = GetScriptForDestination(coinControl->destChange);
{
if (reserveChange > nullCurrencyMap)
{
std::vector<CTxDestination> dest({coinControl->destChange});

// one output for all reserves, change gets combined
// we should separate, or remove any currency that is not whitelisted if specified after whitelist is supported
CTokenOutput to(reserveChange);
scriptChange = MakeMofNCCScript(CConditionObj<CTokenOutput>(EVAL_RESERVE_OUTPUT, dest, 1, &to));
}
else
{
scriptChange = GetScriptForDestination(coinControl->destChange);
}
}
// no coin control: send change to newly generated address
else
{
Expand All @@ -6437,17 +6461,33 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
// Reserve a new key pair from key pool
CPubKey vchPubKey;
extern int32_t USE_EXTERNAL_PUBKEY; extern std::string NOTARY_PUBKEY;

CTxDestination dest;
if ( USE_EXTERNAL_PUBKEY == 0 )
{
bool ret;
ret = reservekey.GetReservedKey(vchPubKey);
assert(ret); // should never fail, as we just unlocked
scriptChange = GetScriptForDestination(vchPubKey.GetID());
dest = CKeyID(vchPubKey.GetID());
}
else
{
//fprintf(stderr,"use notary pubkey\n");
scriptChange = CScript() << ParseHex(NOTARY_PUBKEY) << OP_CHECKSIG;
dest = CPubKey(ParseHex(NOTARY_PUBKEY));
}

if (reserveChange > nullCurrencyMap)
{
std::vector<CTxDestination> dest({coinControl->destChange});

// one output for all reserves, change gets combined
// we should separate, or remove any currency that is not whitelisted if specified after whitelist is supported
CTokenOutput to(reserveChange);
scriptChange = MakeMofNCCScript(CConditionObj<CTokenOutput>(EVAL_RESERVE_OUTPUT, dest, 1, &to));
}
else
{
scriptChange = GetScriptForDestination(dest);
}
}

Expand Down Expand Up @@ -6912,24 +6952,31 @@ int CWallet::CreateReserveTransaction(const vector<CRecipient>& vecSend, CWallet

// generate all necessary change outputs for all currencies
// first determine if any outputs left are dust. if so, just add them to the fee
if (nChange < dustThreshold)
if (nChange < dustThreshold && reserveChange.CanonicalMap() == CCurrencyValueMap())
{
nFeeRet += nChange;
nChange = 0;
}
else
{
nChangePosRet = txNew.vout.size() - 1; // dont change first or last
nChangeOutputs++;
vector<CTxOut>::iterator position = txNew.vout.begin() + nChangePosRet;
txNew.vout.insert(position, CTxOut(nChange, GetScriptForDestination(changeDest)));
if (nChange > 0)
{
nChangeOutputs++;
vector<CTxOut>::iterator position = txNew.vout.begin() + nChangePosRet;
txNew.vout.insert(position, CTxOut(nChange, GetScriptForDestination(changeDest)));
}
}

// now, loop through the remaining reserve currencies and make a change output for each
// now, loop through the remaining reserve currencies and make a change output for each separately
// if dust, just remove
auto reserveIndexMap = currencyState.GetReserveMap();
for (auto &curChangeOut : reserveChange.valueMap)
{
if (!curChangeOut.second)
{
continue;
}
CAmount outVal;
assert(curChangeOut.first != ASSETCHAINS_CHAINID);
auto curIt = reserveIndexMap.find(curChangeOut.first);
Expand All @@ -6942,17 +6989,10 @@ int CWallet::CreateReserveTransaction(const vector<CRecipient>& vecSend, CWallet
outVal = curChangeOut.second;
}

if (outVal >= dustThreshold)
{
vector<CTxOut>::iterator position = txNew.vout.begin() + (nChangePosRet + nChangeOutputs++);
CTokenOutput to = CTokenOutput(curChangeOut.first, curChangeOut.second);
txNew.vout.insert(position, CTxOut(0, MakeMofNCCScript(CConditionObj<CTokenOutput>(EVAL_RESERVE_OUTPUT, {changeDest}, 1, &to))));
}
// if it is dust and we cannot convert to native, drop it. it may be taken by the miner
else if (curIt != reserveIndexMap.end())
{
nFeeRet += outVal;
}
nChangeOutputs++;
vector<CTxOut>::iterator position = txNew.vout.begin() + (nChangePosRet + nChangeOutputs++);
CTokenOutput to = CTokenOutput(curChangeOut.first, curChangeOut.second);
txNew.vout.insert(position, CTxOut(0, MakeMofNCCScript(CConditionObj<CTokenOutput>(EVAL_RESERVE_OUTPUT, {changeDest}, 1, &to))));
}

// if we made no change outputs, return the key
Expand Down
2 changes: 1 addition & 1 deletion src/wallet/wallet.h
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ class CReserveOutSelectionInfo
class CWallet : public CCryptoKeyStore, public CValidationInterface
{
private:
bool SelectCoins(const CAmount& nTargetValue, std::set<std::pair<const CWalletTx*,unsigned int> >& setCoinsRet, CAmount& nValueRet, bool& fOnlyCoinbaseCoinsRet, bool& fNeedCoinbaseCoinsRet, const CCoinControl *coinControl = NULL) const;
bool SelectCoins(const CAmount& nTargetValue, std::set<std::pair<const CWalletTx*,unsigned int> >& setCoinsRet, CAmount& nValueRet, CCurrencyValueMap &reserveChange, bool& fOnlyCoinbaseCoinsRet, bool& fNeedCoinbaseCoinsRet, const CCoinControl *coinControl = NULL) const;
bool SelectReserveCoins(const CCurrencyValueMap& targetReserveValues,
CAmount targetNativeValue,
set<pair<const CWalletTx*,unsigned int> >& setCoinsRet,
Expand Down

0 comments on commit 7b70e4c

Please sign in to comment.