Skip to content

Commit

Permalink
Merge pull request miketout#309 from VerusCoin/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Asherda authored Oct 22, 2020
2 parents 9a9d036 + 2e28856 commit 7d66ad8
Show file tree
Hide file tree
Showing 21 changed files with 579 additions and 253 deletions.
4 changes: 2 additions & 2 deletions .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.2-2
VERSION: 0.7.2-3
VERUS_CLI_ARM64_LINUX: Verus-CLI-Linux-v${VERSION}-arm64.tar.gz
VERUS_CLI_LINUX_AMD64: Verus-CLI-Linux-v${VERSION}-amd64.tar.gz
VERUS_CLI_WINDOWS: Verus-CLI-Windows-v${VERSION}.zip
Expand All @@ -16,7 +16,7 @@ variables:
Pipeline Trigger: ${CI_PIPELINE_SOURCE}\n
Commit: https://github.com/VerusCoin/${CI_PROJECT_NAME}/commit/${CI_COMMIT_SHA}\n
${CI_COMMIT_MESSAGE}"
STRIP_BINARIES: "true"
STRIP_BINARIES: "false"
########################################################################################################################
####END#### PROJECT LEVEL VARIABLES ####END####
########################################################################################################################
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.2-2
## VerusCoin version 0.7.2-3

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
4 changes: 2 additions & 2 deletions depends/packages/libcurl.mk
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package=libcurl
$(package)_version=7.69.1
$(package)_version=7.73.0
$(package)_dependencies=openssl
$(package)_download_path=https://curl.haxx.se/download
$(package)_file_name=curl-$($(package)_version).tar.xz
$(package)_sha256_hash=03c7d5e6697f7b7e40ada1b2256e565a555657398e6c1fcfa4cb251ccd819d4f
$(package)_sha256_hash=7c4c7ca4ea88abe00fea4740dcf81075c031b1d0bb23aff2d5efde20a3c2408a
$(package)_config_opts_linux=--disable-shared --enable-static --prefix=$(host_prefix) --host=$(HOST)
$(package)_config_opts_mingw32=--enable-mingw --disable-shared --enable-static --prefix=$(host_prefix) --host=x86_64-w64-mingw32
$(package)_config_opts_darwin=--disable-shared --enable-static --prefix=$(host_prefix)
Expand Down
13 changes: 7 additions & 6 deletions src/cryptoconditions/compile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#! /bin/sh
# Wrapper for compilers which do not understand '-c -o'.

scriptversion=2012-10-14.11; # UTC
scriptversion=2018-03-07.03; # UTC

# Copyright (C) 1999-2014 Free Software Foundation, Inc.
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
# Written by Tom Tromey <[email protected]>.
#
# This program is free software; you can redistribute it and/or modify
Expand All @@ -17,7 +17,7 @@ scriptversion=2012-10-14.11; # UTC
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <https://www.gnu.org/licenses/>.

# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
Expand Down Expand Up @@ -255,7 +255,8 @@ EOF
echo "compile $scriptversion"
exit $?
;;
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
func_cl_wrapper "$@" # Doesn't return...
;;
esac
Expand Down Expand Up @@ -339,9 +340,9 @@ exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:
2 changes: 1 addition & 1 deletion src/deprecation.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// Deprecation policy:
// * Shut down 20 weeks' worth of blocks after the estimated release block height.
// * A warning is shown during the 2 weeks' worth of blocks prior to shut down.
static const int APPROX_RELEASE_HEIGHT = 1197000;
static const int APPROX_RELEASE_HEIGHT = 1229000;
static const int WEEKS_UNTIL_DEPRECATION = 20;
static const int DEPRECATION_HEIGHT = APPROX_RELEASE_HEIGHT + (WEEKS_UNTIL_DEPRECATION * 7 * 60 * 24);

Expand Down
4 changes: 2 additions & 2 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1602,7 +1602,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
bool checkval,fAddressIndex,fSpentIndex,fTimeStampIndex;
pblocktree = new CBlockTreeDB(nBlockTreeDBCache, false, fReindex, dbCompression, dbMaxOpenFiles);

fAddressIndex = GetBoolArg("-addressindex", DEFAULT_ADDRESSINDEX);
fAddressIndex = true;
pblocktree->ReadFlag("addressindex", checkval);
if ( checkval != fAddressIndex )
{
Expand All @@ -1611,7 +1611,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
fReindex = true;
}

fSpentIndex = GetBoolArg("-spentindex", DEFAULT_SPENTINDEX);
fSpentIndex = true;
pblocktree->ReadFlag("spentindex", checkval);
if ( checkval != fSpentIndex )
{
Expand Down
10 changes: 6 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1872,7 +1872,6 @@ bool AcceptToMemoryPoolInt(CTxMemPool& pool, CValidationState &state, const CTra
// are the actual inputs available?
if (!view.HaveInputs(tx))
{
//fprintf(stderr,"accept failure.1\n");
return state.Invalid(error("AcceptToMemoryPool: inputs already spent"),REJECT_DUPLICATE, "bad-txns-inputs-spent");
}
}
Expand Down Expand Up @@ -2035,9 +2034,12 @@ bool AcceptToMemoryPoolInt(CTxMemPool& pool, CValidationState &state, const CTra
if (!ContextualCheckInputs(tx, state, view, nextBlockHeight, true, STANDARD_SCRIPT_VERIFY_FLAGS, true, txdata, Params().GetConsensus(), consensusBranchId))
{
//fprintf(stderr,"accept failure.9\n");
//UniValue jsonTx(UniValue::VOBJ);
//TxToUniv(tx, uint256(), jsonTx);
//printf("\n%s\n", jsonTx.write(1,2).c_str());
return error("AcceptToMemoryPool: ConnectInputs failed (%s) %s", state.GetRejectReason(), hash.ToString());
}

// Check again against just the consensus-critical mandatory script
// verification flags, in case of bugs in the standard flags that cause
// transactions to pass as valid when they're actually invalid. For
Expand Down Expand Up @@ -6821,14 +6823,14 @@ bool InitBlockIndex(const CChainParams& chainparams)
fTxIndex = GetBoolArg("-txindex", true);
pblocktree->WriteFlag("txindex", fTxIndex);
// Use the provided setting for -addressindex in the new database
fAddressIndex = GetBoolArg("-addressindex", DEFAULT_ADDRESSINDEX);
fAddressIndex = true;
pblocktree->WriteFlag("addressindex", fAddressIndex);

// Use the provided setting for -timestampindex in the new database
fTimestampIndex = GetBoolArg("-timestampindex", DEFAULT_TIMESTAMPINDEX);
pblocktree->WriteFlag("timestampindex", fTimestampIndex);

fSpentIndex = GetBoolArg("-spentindex", DEFAULT_SPENTINDEX);
fSpentIndex = true;
pblocktree->WriteFlag("spentindex", fSpentIndex);
fprintf(stderr,"fAddressIndex.%d/%d fSpentIndex.%d/%d\n",fAddressIndex,DEFAULT_ADDRESSINDEX,fSpentIndex,DEFAULT_SPENTINDEX);
LogPrintf("Initializing databases...\n");
Expand Down
6 changes: 6 additions & 0 deletions src/pbaas/identity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1392,6 +1392,7 @@ bool ValidateIdentityCommitment(struct CCcontract_info *cp, Eval* eval, const CT
{
return eval->Error("Identity reservation output spend does not match commitment");
}

outputNum = i;
}
}
Expand All @@ -1404,6 +1405,11 @@ bool ValidateIdentityCommitment(struct CCcontract_info *cp, Eval* eval, const CT
return ValidateSpendingIdentityReservation(spendingTx, outputNum, eval->state, height, thisChain);
}
}
else
{
printf("%s: error getting transaction %s to spend\n", __func__, spendingTx.vin[nIn].prevout.hash.GetHex().c_str());
}

return true;
}

Expand Down
13 changes: 9 additions & 4 deletions src/qt/transactiondesc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
isminetype fAllToMe = ISMINE_SPENDABLE;
for (int i = 0; i < wtx.vout.size(); i++)
{
isminetype mine = wallet->IsMine(wtx, i);
isminetype mine;
wallet->IsMine(wtx, i, mine);
if(fAllToMe > mine) fAllToMe = mine;
}

Expand All @@ -178,7 +179,8 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
{
const CTxOut& txout = wtx.vout[i];
// Ignore change
isminetype toSelf = wallet->IsMine(wtx, i);
isminetype toSelf;
wallet->IsMine(wtx, i, toSelf);
if ((toSelf == ISMINE_SPENDABLE) && (fAllFromMe == ISMINE_SPENDABLE))
continue;

Expand Down Expand Up @@ -312,8 +314,11 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
strHTML += QString::fromStdString(CBitcoinAddress(address).ToString());
}
strHTML = strHTML + " " + tr("Amount") + "=" + BitcoinUnits::formatHtmlWithUnit(unit, vout.nValue);
strHTML = strHTML + " IsMine=" + (wallet->IsMine(prev, prevout.n) & ISMINE_SPENDABLE ? tr("true") : tr("false")) + "</li>";
strHTML = strHTML + " IsWatchOnly=" + (wallet->IsMine(prev, prevout.n) & ISMINE_WATCH_ONLY ? tr("true") : tr("false")) + "</li>";

isminetype mine;
wallet->IsMine(prev, prevout.n, mine);
strHTML = strHTML + " IsMine=" + (mine & ISMINE_SPENDABLE ? tr("true") : tr("false")) + "</li>";
strHTML = strHTML + " IsWatchOnly=" + (mine & ISMINE_WATCH_ONLY ? tr("true") : tr("false")) + "</li>";
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/rpc/misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1735,7 +1735,7 @@ UniValue getsnapshot(const UniValue& params, bool fHelp)
if ( fHelp || params.size() > 1)
{
throw runtime_error(
"getsnapshot\n"
"getsnapshot\n"
"\nReturns a snapshot of (address,amount) pairs at current height (requires addressindex to be enabled).\n"
"\nArguments:\n"
" \"top\" (number, optional) Only return this many addresses, i.e. top N richlist\n"
Expand Down
37 changes: 33 additions & 4 deletions src/rpc/pbaasrpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5499,7 +5499,7 @@ UniValue registeridentity(const UniValue& params, bool fHelp)

"\nArguments\n"
"{\n"
" \"txid\" : \"hexid\", (hex) the transaction ID of the name committment for this ID name\n"
" \"txid\" : \"hexid\", (hex) the transaction ID of the name commitment for this ID name\n"
" \"namereservation\" :\n"
" {\n"
" \"name\": \"namestr\", (string) the unique name in this commitment\n"
Expand Down Expand Up @@ -5628,10 +5628,30 @@ UniValue registeridentity(const UniValue& params, bool fHelp)
}

// make sure we have a revocation and recovery authority defined
CIdentity revocationAuth = (newID.revocationAuthority.IsNull() || newID.revocationAuthority == newID.GetID()) ? newID : newID.LookupIdentity(newID.revocationAuthority);
CIdentity recoveryAuth = (newID.recoveryAuthority.IsNull() || newID.recoveryAuthority == newID.GetID()) ? newID : newID.LookupIdentity(newID.recoveryAuthority);
CIdentity revocationAuth;
CIdentity recoveryAuth;

if (!recoveryAuth.IsValidUnrevoked() || !revocationAuth.IsValidUnrevoked())
uint160 newIDID = newID.GetID();

if (newID.revocationAuthority == newIDID)
{
revocationAuth = newID;
}
else
{
revocationAuth = newID.LookupIdentity(newID.revocationAuthority);
}

if (newID.recoveryAuthority == newIDID)
{
recoveryAuth = newID;
}
else
{
recoveryAuth = newID.LookupIdentity(newID.recoveryAuthority);
}

if (!(recoveryAuth.IsValidUnrevoked()) || !revocationAuth.IsValidUnrevoked())
{
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid or revoked recovery, or revocation identity.");
}
Expand Down Expand Up @@ -5805,6 +5825,15 @@ UniValue updateidentity(const UniValue& params, bool fHelp)
throw JSONRPCError(RPC_INVALID_PARAMETER, "ID not found " + newID.ToUniValue().write());
}

// make sure we have a revocation and recovery authority defined
CIdentity revocationAuth = newID.LookupIdentity(newID.revocationAuthority);
CIdentity recoveryAuth = newID.LookupIdentity(newID.recoveryAuthority);

if (!recoveryAuth.IsValidUnrevoked() || !revocationAuth.IsValidUnrevoked())
{
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid or revoked recovery, or revocation identity.");
}

CMutableTransaction txNew = CreateNewContextualCMutableTransaction(Params().GetConsensus(), nHeight);

if (oldID.IsLocked() != newID.IsLocked())
Expand Down
60 changes: 55 additions & 5 deletions src/script/standard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ bool ExtractDestinations(const CScript& scriptPubKey,
const CKeyStore *pKeyStore,
bool *pCanSign,
bool *pCanSpend,
uint32_t lastIdHeight,
uint32_t nHeight,
std::map<uint160, CKey> *pPrivKeys)
{
addressRet.clear();
Expand All @@ -579,12 +579,21 @@ bool ExtractDestinations(const CScript& scriptPubKey,
CScript postfix = CScript(scriptPubKey.size() > scriptStart ? scriptPubKey.begin() + scriptStart : scriptPubKey.end(), scriptPubKey.end());

// check again with only postfix subscript
return(ExtractDestinations(postfix, typeRet, addressRet, nRequiredRet, pKeyStore, pCanSign, pCanSpend, lastIdHeight, pPrivKeys));
return(ExtractDestinations(postfix, typeRet, addressRet, nRequiredRet, pKeyStore, pCanSign, pCanSpend, nHeight, pPrivKeys));
}

int canSpendCount = 0;
bool canSign = false;

if (pCanSign)
{
*pCanSign = false;
}
if (pCanSpend)
{
*pCanSpend = false;
}

COptCCParams master, p;
bool ccValid;
if (scriptPubKey.IsPayToCryptoCondition(p))
Expand All @@ -609,7 +618,7 @@ bool ExtractDestinations(const CScript& scriptPubKey,
std::pair<CIdentityMapKey, CIdentityMapValue> identity;
idSet.insert(destId);

if (pKeyStore && pKeyStore->GetIdentity(destId, identity, lastIdHeight) && identity.second.IsValidUnrevoked())
if (pKeyStore && pKeyStore->GetIdentity(destId, identity, nHeight - 1) && identity.second.IsValidUnrevoked())
{
int canSignCount = 0;
for (auto oneKey : identity.second.primaryAddresses)
Expand Down Expand Up @@ -705,7 +714,7 @@ bool ExtractDestinations(const CScript& scriptPubKey,

//printf("checking: %s\n", EncodeDestination(dest).c_str());

if (pKeyStore && pKeyStore->GetIdentity(destId, identity, lastIdHeight) && identity.second.IsValidUnrevoked())
if (pKeyStore && pKeyStore->GetIdentity(destId, identity, nHeight - 1) && identity.second.IsValidUnrevoked())
{
int canSignCount = 0;
for (auto oneKey : identity.second.primaryAddresses)
Expand Down Expand Up @@ -778,6 +787,14 @@ bool ExtractDestinations(const CScript& scriptPubKey,
// this kind of ID is defined as a CKeyID, since use of script hash type in CCs are reserved for IDs
addressRet.push_back(CKeyID(Hash160(subScr)));
nRequiredRet = 1;
if (pCanSign)
{
*pCanSign = true;
}
if (pCanSpend)
{
*pCanSpend = true;
}
}
else
{
Expand All @@ -803,6 +820,7 @@ bool ExtractDestinations(const CScript& scriptPubKey,
if (typeRet == TX_MULTISIG)
{
nRequiredRet = vSolutions.front()[0];
int nHaveKeys = 0;
for (unsigned int i = 1; i < vSolutions.size()-1; i++)
{
CPubKey pubKey(vSolutions[i]);
Expand All @@ -811,20 +829,52 @@ bool ExtractDestinations(const CScript& scriptPubKey,

CTxDestination address = pubKey.GetID();
addressRet.push_back(address);

// if we were asked to see whether we can sign or spend, determine
if ((pCanSign || pCanSpend) && pKeyStore)
{
if (pKeyStore->HaveKey(GetDestinationID(address)))
{
nHaveKeys++;
}
}
}

if (addressRet.empty())
return false;

if (pCanSign && nHaveKeys)
{
*pCanSign = true;
}
if (pCanSpend && nHaveKeys >= nRequiredRet)
{
*pCanSpend = true;
}
}
else
{
nRequiredRet = 1;
CTxDestination address;
if (!ExtractDestination(scriptPubKey, address))
{
return false;
return false;
}
addressRet.push_back(address);
if ((pCanSign || pCanSpend) && pKeyStore)
{
if (pKeyStore->HaveKey(GetDestinationID(address)))
{
if (pCanSign)
{
*pCanSign = true;
}
if (pCanSpend)
{
*pCanSpend = true;
}
}
}
}
}

Expand Down
Loading

0 comments on commit 7d66ad8

Please sign in to comment.