Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IX fixes: #610

Merged
merged 1 commit into from
Sep 15, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ std::string HelpMessage(HelpMessageMode mode)

strUsage += "\n" + _("InstantX options:") + "\n";
strUsage += " -enableinstantx=<n> " + strprintf(_("Enable instantx, show confirmations for locked transactions (bool, default: %s)"), "true") + "\n";
strUsage += " -instantxdepth=<n> " + strprintf(_("Show N confirmations for a successfully locked transaction (0-9999, default: %u)"), 1) + "\n";
strUsage += " -instantxdepth=<n> " + strprintf(_("Show N confirmations for a successfully locked transaction (0-9999, default: %u)"), nInstantXDepth) + "\n";

strUsage += "\n" + _("Node relay options:") + "\n";
strUsage += " -datacarrier " + strprintf(_("Relay and mine data carrier transactions (default: %u)"), 1) + "\n";
Expand Down Expand Up @@ -698,6 +698,11 @@ bool AppInit2(boost::thread_group& threadGroup)
LogPrintf("AppInit2 : parameter interaction: -zapwallettxes=<mode> -> setting -rescan=1\n");
}

if(!GetBoolArg("-enableinstantx", fEnableInstantX)){
if (SoftSetArg("-instantxdepth", 0))
LogPrintf("AppInit2 : parameter interaction: -enableinstantx=false -> setting -nInstantXDepth=0\n");
}

// Make sure enough file descriptors are available
int nBind = std::max((int)mapArgs.count("-bind") + (int)mapArgs.count("-whitebind"), 1);
nMaxConnections = GetArg("-maxconnections", 125);
Expand Down Expand Up @@ -1532,14 +1537,9 @@ bool AppInit2(boost::thread_group& threadGroup)
if(nAnonymizeDarkcoinAmount > 999999) nAnonymizeDarkcoinAmount = 999999;
if(nAnonymizeDarkcoinAmount < 2) nAnonymizeDarkcoinAmount = 2;

bool fEnableInstantX = GetBoolArg("-enableinstantx", true);
if(fEnableInstantX){
nInstantXDepth = GetArg("-instantxdepth", 5);
if(nInstantXDepth > 60) nInstantXDepth = 60;
if(nInstantXDepth < 0) nAnonymizeDarkcoinAmount = 0;
} else {
nInstantXDepth = 0;
}
fEnableInstantX = GetBoolArg("-enableinstantx", fEnableInstantX);
nInstantXDepth = GetArg("-instantxdepth", nInstantXDepth);
nInstantXDepth = std::min(std::max(nInstantXDepth, 0), 60);

//lite mode disables all Masternode and Darksend related functionality
fLiteMode = GetBoolArg("-litemode", false);
Expand Down
6 changes: 6 additions & 0 deletions src/qt/walletmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,12 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact
bool fCreated = wallet->CreateTransaction(vecSend, *newTx, *keyChange, nFeeRequired, strFailReason, coinControl, recipients[0].inputType, recipients[0].useInstantX);
transaction.setTransactionFee(nFeeRequired);

if(recipients[0].useInstantX && newTx->GetValueOut() > GetSporkValue(SPORK_5_MAX_VALUE)*COIN){
emit message(tr("Send Coins"), tr("InstantX doesn't support sending values that high yet. Transactions are currently limited to %1 DASH.").arg(GetSporkValue(SPORK_5_MAX_VALUE)),
CClientUIInterface::MSG_ERROR);
return TransactionCreationFailed;
}

if(!fCreated)
{
if((total + nFeeRequired) > nBalance)
Expand Down
22 changes: 20 additions & 2 deletions src/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ void EnsureWalletIsUnlocked()
void WalletTxToJSON(const CWalletTx& wtx, Object& entry)
{
int confirms = wtx.GetDepthInMainChain(false);
entry.push_back(Pair("confirmations", confirms));
int confirmsTotal = wtx.GetDepthInMainChain();
entry.push_back(Pair("confirmations", confirmsTotal));
entry.push_back(Pair("bcconfirmations", confirms));
if (wtx.IsCoinBase())
entry.push_back(Pair("generated", true));
if (confirms > 0)
Expand Down Expand Up @@ -1006,12 +1008,14 @@ struct tallyitem
{
CAmount nAmount;
int nConf;
int nBCConf;
vector<uint256> txids;
bool fIsWatchonly;
tallyitem()
{
nAmount = 0;
nConf = std::numeric_limits<int>::max();
nBCConf = std::numeric_limits<int>::max();
fIsWatchonly = false;
}
};
Expand Down Expand Up @@ -1043,6 +1047,7 @@ Value ListReceived(const Array& params, bool fByAccounts)
continue;

int nDepth = wtx.GetDepthInMainChain();
int nBCDepth = wtx.GetDepthInMainChain(false);
if (nDepth < nMinDepth)
continue;

Expand All @@ -1059,6 +1064,7 @@ Value ListReceived(const Array& params, bool fByAccounts)
tallyitem& item = mapTally[address];
item.nAmount += txout.nValue;
item.nConf = min(item.nConf, nDepth);
item.nBCConf = min(item.nBCConf, nBCDepth);
item.txids.push_back(wtx.GetHash());
if (mine & ISMINE_WATCH_ONLY)
item.fIsWatchonly = true;
Expand All @@ -1078,11 +1084,13 @@ Value ListReceived(const Array& params, bool fByAccounts)

CAmount nAmount = 0;
int nConf = std::numeric_limits<int>::max();
int nBCConf = std::numeric_limits<int>::max();
bool fIsWatchonly = false;
if (it != mapTally.end())
{
nAmount = (*it).second.nAmount;
nConf = (*it).second.nConf;
nBCConf = (*it).second.nBCConf;
fIsWatchonly = (*it).second.fIsWatchonly;
}

Expand All @@ -1091,6 +1099,7 @@ Value ListReceived(const Array& params, bool fByAccounts)
tallyitem& item = mapAccountTally[strAccount];
item.nAmount += nAmount;
item.nConf = min(item.nConf, nConf);
item.nBCConf = min(item.nBCConf, nBCConf);
item.fIsWatchonly = fIsWatchonly;
}
else
Expand All @@ -1102,6 +1111,7 @@ Value ListReceived(const Array& params, bool fByAccounts)
obj.push_back(Pair("account", strAccount));
obj.push_back(Pair("amount", ValueFromAmount(nAmount)));
obj.push_back(Pair("confirmations", (nConf == std::numeric_limits<int>::max() ? 0 : nConf)));
obj.push_back(Pair("bcconfirmations", (nBCConf == std::numeric_limits<int>::max() ? 0 : nBCConf)));
Array transactions;
if (it != mapTally.end())
{
Expand All @@ -1121,12 +1131,14 @@ Value ListReceived(const Array& params, bool fByAccounts)
{
CAmount nAmount = (*it).second.nAmount;
int nConf = (*it).second.nConf;
int nBCConf = (*it).second.nBCConf;
Object obj;
if((*it).second.fIsWatchonly)
obj.push_back(Pair("involvesWatchonly", true));
obj.push_back(Pair("account", (*it).first));
obj.push_back(Pair("amount", ValueFromAmount(nAmount)));
obj.push_back(Pair("confirmations", (nConf == std::numeric_limits<int>::max() ? 0 : nConf)));
obj.push_back(Pair("bcconfirmations", (nBCConf == std::numeric_limits<int>::max() ? 0 : nBCConf)));
ret.push_back(obj);
}
}
Expand All @@ -1153,6 +1165,7 @@ Value listreceivedbyaddress(const Array& params, bool fHelp)
" \"account\" : \"accountname\", (string) The account of the receiving address. The default account is \"\".\n"
" \"amount\" : x.xxx, (numeric) The total amount in btc received by the address\n"
" \"confirmations\" : n (numeric) The number of confirmations of the most recent transaction included\n"
" \"bcconfirmations\" : n (numeric) The number of blockchain confirmations of the most recent transaction included\n"
" }\n"
" ,...\n"
"]\n"
Expand Down Expand Up @@ -1184,6 +1197,7 @@ Value listreceivedbyaccount(const Array& params, bool fHelp)
" \"account\" : \"accountname\", (string) The account name of the receiving account\n"
" \"amount\" : x.xxx, (numeric) The total amount received by addresses with this account\n"
" \"confirmations\" : n (numeric) The number of confirmations of the most recent transaction included\n"
" \"bcconfirmations\" : n (numeric) The number of blockchain confirmations of the most recent transaction included\n"
" }\n"
" ,...\n"
"]\n"
Expand Down Expand Up @@ -1323,6 +1337,8 @@ Value listtransactions(const Array& params, bool fHelp)
" 'send' category of transactions.\n"
" \"confirmations\": n, (numeric) The number of confirmations for the transaction. Available for 'send' and \n"
" 'receive' category of transactions.\n"
" \"bcconfirmations\": n, (numeric) The number of blockchain confirmations for the transaction. Available for 'send'\n"
" and 'receive' category of transactions.\n"
" \"blockhash\": \"hashvalue\", (string) The block hash containing the transaction. Available for 'send' and 'receive'\n"
" category of transactions.\n"
" \"blockindex\": n, (numeric) The block index containing the transaction. Available for 'send' and 'receive'\n"
Expand Down Expand Up @@ -1500,6 +1516,7 @@ Value listsinceblock(const Array& params, bool fHelp)
" \"vout\" : n, (numeric) the vout value\n"
" \"fee\": x.xxx, (numeric) The amount of the fee in btc. This is negative and only available for the 'send' category of transactions.\n"
" \"confirmations\": n, (numeric) The number of confirmations for the transaction. Available for 'send' and 'receive' category of transactions.\n"
" \"bcconfirmations\" : n, (numeric) The number of blockchain confirmations for the transaction. Available for 'send' and 'receive' category of transactions.\n"
" \"blockhash\": \"hashvalue\", (string) The block hash containing the transaction. Available for 'send' and 'receive' category of transactions.\n"
" \"blockindex\": n, (numeric) The block index containing the transaction. Available for 'send' and 'receive' category of transactions.\n"
" \"blocktime\": xxx, (numeric) The block time in seconds since epoch (1 Jan 1970 GMT).\n"
Expand Down Expand Up @@ -1551,7 +1568,7 @@ Value listsinceblock(const Array& params, bool fHelp)
{
CWalletTx tx = (*it).second;

if (depth == -1 || tx.GetDepthInMainChain() < depth)
if (depth == -1 || tx.GetDepthInMainChain(false) < depth)
ListTransactions(tx, "*", 0, true, transactions, filter);
}

Expand All @@ -1578,6 +1595,7 @@ Value gettransaction(const Array& params, bool fHelp)
"{\n"
" \"amount\" : x.xxx, (numeric) The transaction amount in btc\n"
" \"confirmations\" : n, (numeric) The number of confirmations\n"
" \"bcconfirmations\" : n, (numeric) The number of blockchain confirmations\n"
" \"blockhash\" : \"hash\", (string) The block hash\n"
" \"blockindex\" : xx, (numeric) The block index\n"
" \"blocktime\" : ttt, (numeric) The time in seconds since epoch (1 Jan 1970 GMT)\n"
Expand Down
3 changes: 2 additions & 1 deletion src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ bool fMasterNode = false;
string strMasterNodePrivKey = "";
string strMasterNodeAddr = "";
bool fLiteMode = false;
int nInstantXDepth = 1;
bool fEnableInstantX = true;
int nInstantXDepth = 5;
int nDarksendRounds = 2;
int nAnonymizeDarkcoinAmount = 1000;
int nLiquidityProvider = 0;
Expand Down
1 change: 1 addition & 0 deletions src/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

extern bool fMasterNode;
extern bool fLiteMode;
extern bool fEnableInstantX;
extern int nInstantXDepth;
extern int nDarksendRounds;
extern int nAnonymizeDarkcoinAmount;
Expand Down
4 changes: 2 additions & 2 deletions src/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3254,7 +3254,7 @@ int CMerkleTx::GetTransactionLockSignatures() const
{
if(fLargeWorkForkFound || fLargeWorkInvalidChainFound) return -2;
if(!IsSporkActive(SPORK_2_INSTANTX)) return -3;
if(nInstantXDepth == 0) return -1;
if(!fEnableInstantX) return -1;

//compile consessus vote
std::map<uint256, CTransactionLock>::iterator i = mapTxLocks.find(GetHash());
Expand All @@ -3267,7 +3267,7 @@ int CMerkleTx::GetTransactionLockSignatures() const

bool CMerkleTx::IsTransactionLockTimedOut() const
{
if(nInstantXDepth == 0) return 0;
if(!fEnableInstantX) return 0;

//compile consessus vote
std::map<uint256, CTransactionLock>::iterator i = mapTxLocks.find(GetHash());
Expand Down