Compare commits
190 Commits
2.0
...
8c87e8d8c1
| Author | SHA1 | Date | |
|---|---|---|---|
| 8c87e8d8c1 | |||
| b9976d51fa | |||
| 1ef86d8f21 | |||
| 55bf40cf5a | |||
| 338d0a13c4 | |||
| 7c70e8f797 | |||
| 9fa62f90a0 | |||
| b0b25693d2 | |||
| e84fedbac4 | |||
| 51508378a3 | |||
| 30c9410493 | |||
| 35203fb552 | |||
| bff1d8c60f | |||
| 0dcb6ed797 | |||
| 858e57ac8b | |||
| 6af196d209 | |||
| 916bb8b9d4 | |||
| b2e53454a0 | |||
| 1e1f955b0f | |||
| f591ddbdb3 | |||
| 90a4625b5a | |||
| 48e03e1aae | |||
| 3ef205dfdb | |||
| 6ea844a6d5 | |||
| 012034bdd3 | |||
| f5a4d61f83 | |||
| b193420eb5 | |||
| 49a9673a1d | |||
| ddd1aeb0ed | |||
| 1216ca1a9f | |||
| 53fda4616b | |||
| a3b9dcf6d7 | |||
| bc3bf72332 | |||
| 5a1477ea6f | |||
| 57d8b7efc6 | |||
| 396664ba14 | |||
| 97f87d2741 | |||
| 02746d4d85 | |||
| fdff3c46c2 | |||
| cc1be9689d | |||
| e66b75ce3b | |||
| 82e3799364 | |||
| 2e080bdbce | |||
| f7e87d8ee8 | |||
| 4d3dc3e8b4 | |||
| 98d87fbfbe | |||
| 77daceed22 | |||
| 44bf9f59e1 | |||
| c6466edd73 | |||
| d33b24cb4d | |||
| f5da817541 | |||
| 0be7546eca | |||
| 49606584a5 | |||
| 310889630e | |||
| 0884792a04 | |||
| fa60bb64dc | |||
| 9833666a23 | |||
| 003a4277f6 | |||
| 79383cc6ef | |||
| fb3e2f9565 | |||
| 2504a87f61 | |||
| 84c60e89d0 | |||
| e3706beada | |||
| 240b9a2c0e | |||
| 85d1c5149a | |||
| d2694f7387 | |||
| d91ac14734 | |||
| c11766e2eb | |||
| a3c4e67524 | |||
| db8676c8d0 | |||
| 7e5a74a83b | |||
| 82c8c0bb65 | |||
| 90537bf907 | |||
| c712d58579 | |||
| 95f86236d7 | |||
| bd41d2cae9 | |||
| 71fde3d8dc | |||
| 73989f6df8 | |||
| 2c3a4e3dcb | |||
| 44e7de7b51 | |||
| 2cf1900095 | |||
| 4687946339 | |||
| 5a42058c16 | |||
| a72481b702 | |||
| 97542c55be | |||
| 5ff22a3fce | |||
| 3514890cfa | |||
| 68c8d5787c | |||
| c148c18a4d | |||
| a60e61eecb | |||
| a46ee6484a | |||
| e589e128c7 | |||
| 66acb6c43f | |||
| 62e7c50711 | |||
| 01a43bd077 | |||
| aecbceeb37 | |||
| 040b028118 | |||
| aefc1a5bf9 | |||
| df25ff5645 | |||
| 59ee5d54ca | |||
| 4b8eaec50b | |||
| a69496a400 | |||
| 849fd49dfa | |||
| f744d832f3 | |||
| ed99f2df82 | |||
| 4bc3dc6e9f | |||
| 23c2bb19ad | |||
| 54d5305a03 | |||
| bf41651b5e | |||
| 33c0ee872c | |||
| 50fec755e6 | |||
| 001b1679ea | |||
| a6866fd45e | |||
| a82703653a | |||
| ee4be4658f | |||
| 2d8e5615b4 | |||
| e6d6d2d5f6 | |||
| 5e6a9b86db | |||
| 28e6ffc6a9 | |||
| 7e00a3e850 | |||
| 16091f5a27 | |||
| 7f9fa6c28d | |||
| e4ef1cca4d | |||
| 4dff1ca7c7 | |||
| 9eb72f52b0 | |||
| edae39584d | |||
| dc3c036c50 | |||
| 95d92df921 | |||
| 1f690a9aca | |||
| 2bd7811e47 | |||
| cb75fc358c | |||
| 084afa29d0 | |||
| 4ecd4dcc7d | |||
| e409febb7f | |||
| 2c164ca916 | |||
| 2e5a686cd1 | |||
| 9b3ce29227 | |||
| 1e10a3bd14 | |||
| fab40f026f | |||
| 1edb42e76f | |||
| 3cae8db8ee | |||
| ddf048f7db | |||
| 784b438464 | |||
| 2eb55e21d0 | |||
| 6dc39ddb2b | |||
| 37157782e3 | |||
| a335974218 | |||
| cc75588cb0 | |||
| d1639fe46d | |||
| 0c0c3568be | |||
| 903bad2d49 | |||
| 23a1058588 | |||
| 160beec0f4 | |||
| b7dc179af3 | |||
| b4ebf6bb88 | |||
| 4a636ebf2f | |||
| 4e7adb1150 | |||
| 85e0721566 | |||
| d4261a669b | |||
| 0f4ad90331 | |||
| ec427be05a | |||
| c1d42448f8 | |||
| 036e4d890d | |||
| 2261fbcc40 | |||
| 09dcc40281 | |||
| 2a750d25f3 | |||
| c306cbcf23 | |||
| 71d8d0de91 | |||
| 5b332b35fa | |||
| 0ff547ee43 | |||
| 3fa52a9cf6 | |||
| eb67e00cd7 | |||
| 0279205e72 | |||
| d3d2bec1ed | |||
| c09d143e5d | |||
| 25b1b2637d | |||
| f462f91acf | |||
| 93f2ee7cfe | |||
| cbd5c9a57c | |||
| f94f45d8f8 | |||
| 9d7cccbc63 | |||
| cea142ff6a | |||
| cbf03f89b7 | |||
| 5b23170158 | |||
| 04862cf7a7 | |||
| eb87369a49 | |||
| bb5350aca5 | |||
| 9318562278 | |||
| 0adc90a9f1 | |||
| b8e8717fe6 |
@@ -4,6 +4,7 @@ set -euo pipefail
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
JOBS="${JOBS:-1}"
|
||||
MODE="${MODE:-daemon}"
|
||||
DAEMON_TARGETS="${DAEMON_TARGETS:-agrariand agrarian-cli agrarian-tx}"
|
||||
HOST="${HOST:-$("$ROOT/depends/config.guess")}"
|
||||
PREFIX="$ROOT/depends/$HOST"
|
||||
BASE_CONFIG="$PREFIX/share/config.site"
|
||||
@@ -50,7 +51,7 @@ case "$MODE" in
|
||||
--disable-bench \
|
||||
--disable-zmq \
|
||||
--with-miniupnpc=no \
|
||||
CXXFLAGS="${CXXFLAGS:--O0 -g0 --param ggc-min-expand=1 --param ggc-min-heapsize=32768}"
|
||||
CXXFLAGS="${CXXFLAGS:--O0 -g0 --param ggc-min-expand=20 --param ggc-min-heapsize=131072}"
|
||||
|
||||
echo "Cleaning stale target objects before compiling..."
|
||||
make clean
|
||||
@@ -65,5 +66,9 @@ case "$MODE" in
|
||||
;;
|
||||
esac
|
||||
|
||||
make -j"$JOBS"
|
||||
if [[ "$MODE" == "daemon" ]]; then
|
||||
make -C src -j"$JOBS" $DAEMON_TARGETS
|
||||
else
|
||||
make -j"$JOBS"
|
||||
fi
|
||||
echo "Linux $MODE build complete."
|
||||
|
||||
+9717
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -217,7 +217,7 @@ public:
|
||||
|
||||
convertSeed6(vFixedSeeds, pnSeed6_main, ARRAYLEN(pnSeed6_main));
|
||||
|
||||
fMiningRequiresPeers = true;
|
||||
fMiningRequiresPeers = false;
|
||||
fAllowMinDifficultyBlocks = false;
|
||||
fDefaultConsistencyChecks = false;
|
||||
fRequireStandard = true;
|
||||
|
||||
@@ -15,10 +15,7 @@
|
||||
|
||||
uint256 CBlockHeader::GetHash() const
|
||||
{
|
||||
if(nVersion < 4)
|
||||
return HashQuark(BEGIN(nVersion), END(nNonce));
|
||||
|
||||
return Hash(BEGIN(nVersion), END(nAccumulatorCheckpoint));
|
||||
return HashQuark(BEGIN(nVersion), END(nNonce));
|
||||
}
|
||||
|
||||
uint256 CBlock::BuildMerkleTree(bool* fMutated) const
|
||||
|
||||
+2
-1
@@ -460,7 +460,7 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp)
|
||||
if (strMode != "template")
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode");
|
||||
|
||||
if (vNodes.empty())
|
||||
if (vNodes.empty() && Params().MiningRequiresPeers())
|
||||
throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, "Agrarian is not connected!");
|
||||
|
||||
if (IsInitialBlockDownload())
|
||||
@@ -605,6 +605,7 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp)
|
||||
result.push_back(Pair("curtime", pblock->GetBlockTime()));
|
||||
result.push_back(Pair("bits", strprintf("%08x", pblock->nBits)));
|
||||
result.push_back(Pair("height", (int64_t)(pindexPrev->nHeight + 1)));
|
||||
result.push_back(Pair("acc_checkpoint", pblock->nAccumulatorCheckpoint.GetHex()));
|
||||
result.push_back(Pair("votes", aVotes));
|
||||
|
||||
|
||||
|
||||
@@ -914,9 +914,9 @@ UniValue sendfrom(const UniValue& params, bool fHelp)
|
||||
|
||||
UniValue sendmany(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (fHelp || params.size() < 2 || params.size() > 4)
|
||||
if (fHelp || params.size() < 2 || params.size() > 8)
|
||||
throw runtime_error(
|
||||
"sendmany \"fromaccount\" {\"address\":amount,...} ( minconf \"comment\" )\n"
|
||||
"sendmany \"fromaccount\" {\"address\":amount,...} ( minconf \"comment\" subtractfeefrom )\n"
|
||||
"\nSend multiple times. Amounts are double-precision floating point numbers." +
|
||||
HelpRequiringPassphrase() + "\n"
|
||||
|
||||
@@ -929,6 +929,8 @@ UniValue sendmany(const UniValue& params, bool fHelp)
|
||||
" }\n"
|
||||
"3. minconf (numeric, optional, default=1) Only use the balance confirmed at least this many times.\n"
|
||||
"4. \"comment\" (string, optional) A comment\n"
|
||||
"5. subtractfeefrom (array, optional) A json array with addresses that pay the fee\n"
|
||||
"\nAlso accepts Dash/PIVX-style sendmany arguments where comment is argument 5 and subtractfeefrom is argument 6.\n"
|
||||
|
||||
"\nResult:\n"
|
||||
"\"transactionid\" (string) The transaction id for the send. Only 1 transaction is created regardless of \n"
|
||||
@@ -952,15 +954,31 @@ UniValue sendmany(const UniValue& params, bool fHelp)
|
||||
|
||||
CWalletTx wtx;
|
||||
wtx.strFromAccount = strAccount;
|
||||
if (params.size() > 3 && !params[3].isNull() && !params[3].get_str().empty())
|
||||
wtx.mapValue["comment"] = params[3].get_str();
|
||||
int nCommentIndex = 3;
|
||||
int nSubtractFeeFromIndex = 4;
|
||||
if (params.size() > 3 && params[3].isBool()) {
|
||||
nCommentIndex = 4;
|
||||
nSubtractFeeFromIndex = 5;
|
||||
}
|
||||
|
||||
if (params.size() > nCommentIndex && !params[nCommentIndex].isNull() && params[nCommentIndex].isStr() && !params[nCommentIndex].get_str().empty())
|
||||
wtx.mapValue["comment"] = params[nCommentIndex].get_str();
|
||||
|
||||
set<CBitcoinAddress> setAddress;
|
||||
set<string> setSubtractFeeFromAddress;
|
||||
set<int> setSubtractFeeFromOutputs;
|
||||
vector<pair<CScript, CAmount> > vecSend;
|
||||
|
||||
if (params.size() > nSubtractFeeFromIndex && !params[nSubtractFeeFromIndex].isNull()) {
|
||||
UniValue subtractFeeFrom = params[nSubtractFeeFromIndex].get_array();
|
||||
for (unsigned int idx = 0; idx < subtractFeeFrom.size(); idx++)
|
||||
setSubtractFeeFromAddress.insert(subtractFeeFrom[idx].get_str());
|
||||
}
|
||||
|
||||
CAmount totalAmount = 0;
|
||||
vector<string> keys = sendTo.getKeys();
|
||||
for (const string& name_ : keys) {
|
||||
for (unsigned int i = 0; i < keys.size(); i++) {
|
||||
const string& name_ = keys[i];
|
||||
CBitcoinAddress address(name_);
|
||||
if (!address.IsValid())
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, string("Invalid Agrarian address: ")+name_);
|
||||
@@ -974,12 +992,21 @@ UniValue sendmany(const UniValue& params, bool fHelp)
|
||||
totalAmount += nAmount;
|
||||
|
||||
vecSend.push_back(make_pair(scriptPubKey, nAmount));
|
||||
|
||||
if (setSubtractFeeFromAddress.count(name_))
|
||||
setSubtractFeeFromOutputs.insert(i);
|
||||
}
|
||||
|
||||
for (const string& name_ : setSubtractFeeFromAddress) {
|
||||
if (!sendTo.exists(name_))
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid parameter, subtract fee from address not in send set: ")+name_);
|
||||
}
|
||||
|
||||
EnsureWalletIsUnlocked();
|
||||
|
||||
// Check funds
|
||||
CAmount nBalance = GetAccountBalance(strAccount, nMinDepth, ISMINE_SPENDABLE);
|
||||
// Check funds. Treat an empty fromaccount as whole-wallet spendable balance for
|
||||
// compatibility with modern Bitcoin-family payout callers.
|
||||
CAmount nBalance = strAccount.empty() ? pwalletMain->GetBalance() : GetAccountBalance(strAccount, nMinDepth, ISMINE_SPENDABLE);
|
||||
if (totalAmount > nBalance)
|
||||
throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Account has insufficient funds");
|
||||
|
||||
@@ -987,7 +1014,7 @@ UniValue sendmany(const UniValue& params, bool fHelp)
|
||||
CReserveKey keyChange(pwalletMain);
|
||||
CAmount nFeeRequired = 0;
|
||||
string strFailReason;
|
||||
bool fCreated = pwalletMain->CreateTransaction(vecSend, wtx, keyChange, nFeeRequired, strFailReason);
|
||||
bool fCreated = pwalletMain->CreateTransaction(vecSend, wtx, keyChange, nFeeRequired, strFailReason, NULL, ALL_COINS, false, 0, &setSubtractFeeFromOutputs);
|
||||
if (!fCreated)
|
||||
throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, strFailReason);
|
||||
if (!pwalletMain->CommitTransaction(wtx, keyChange))
|
||||
|
||||
+44
-10
@@ -2094,11 +2094,13 @@ bool CWallet::CreateTransaction(const vector<pair<CScript, CAmount> >& vecSend,
|
||||
const CCoinControl* coinControl,
|
||||
AvailableCoinsType coin_type,
|
||||
bool useIX,
|
||||
CAmount nFeePay)
|
||||
CAmount nFeePay,
|
||||
const std::set<int>* setSubtractFeeFromOutputs)
|
||||
{
|
||||
if (useIX && nFeePay < CENT) nFeePay = CENT;
|
||||
|
||||
CAmount nValue = 0;
|
||||
const bool fSubtractFeeFromAmount = setSubtractFeeFromOutputs && !setSubtractFeeFromOutputs->empty();
|
||||
|
||||
for (const PAIRTYPE(CScript, CAmount) & s : vecSend) {
|
||||
if (nValue < 0) {
|
||||
@@ -2126,13 +2128,29 @@ bool CWallet::CreateTransaction(const vector<pair<CScript, CAmount> >& vecSend,
|
||||
txNew.vout.clear();
|
||||
wtxNew.fFromMe = true;
|
||||
|
||||
CAmount nTotalValue = nValue + nFeeRet;
|
||||
CAmount nTotalValue = nValue + (fSubtractFeeFromAmount ? 0 : nFeeRet);
|
||||
double dPriority = 0;
|
||||
|
||||
// vouts to the payees
|
||||
if (coinControl && !coinControl->fSplitBlock) {
|
||||
for (const PAIRTYPE(CScript, CAmount) & s : vecSend) {
|
||||
CTxOut txout(s.second, s.first);
|
||||
for (unsigned int i = 0; i < vecSend.size(); i++) {
|
||||
const PAIRTYPE(CScript, CAmount)& s = vecSend[i];
|
||||
CAmount nAmount = s.second;
|
||||
|
||||
if(fSubtractFeeFromAmount && setSubtractFeeFromOutputs->count(i)) {
|
||||
CAmount nSubtractFee = nFeeRet / setSubtractFeeFromOutputs->size();
|
||||
if (i == (unsigned int)*setSubtractFeeFromOutputs->begin())
|
||||
nSubtractFee += nFeeRet % setSubtractFeeFromOutputs->size();
|
||||
|
||||
nAmount -= nSubtractFee;
|
||||
}
|
||||
|
||||
if (nAmount <= 0) {
|
||||
strFailReason = _("The transaction amount is too small to pay the fee");
|
||||
return false;
|
||||
}
|
||||
|
||||
CTxOut txout(nAmount, s.first);
|
||||
if (txout.IsDust(::minRelayTxFee)) {
|
||||
strFailReason = _("Transaction amount too small");
|
||||
return false;
|
||||
@@ -2148,13 +2166,29 @@ bool CWallet::CreateTransaction(const vector<pair<CScript, CAmount> >& vecSend,
|
||||
else
|
||||
nSplitBlock = 1;
|
||||
|
||||
for (const PAIRTYPE(CScript, CAmount) & s : vecSend) {
|
||||
for (int i = 0; i < nSplitBlock; i++) {
|
||||
if (i == nSplitBlock - 1) {
|
||||
uint64_t nRemainder = s.second % nSplitBlock;
|
||||
txNew.vout.push_back(CTxOut((s.second / nSplitBlock) + nRemainder, s.first));
|
||||
for (unsigned int i = 0; i < vecSend.size(); i++) {
|
||||
const PAIRTYPE(CScript, CAmount)& s = vecSend[i];
|
||||
CAmount nAmount = s.second;
|
||||
|
||||
if(fSubtractFeeFromAmount && setSubtractFeeFromOutputs->count(i)) {
|
||||
CAmount nSubtractFee = nFeeRet / setSubtractFeeFromOutputs->size();
|
||||
if (i == (unsigned int)*setSubtractFeeFromOutputs->begin())
|
||||
nSubtractFee += nFeeRet % setSubtractFeeFromOutputs->size();
|
||||
|
||||
nAmount -= nSubtractFee;
|
||||
}
|
||||
|
||||
if (nAmount <= 0) {
|
||||
strFailReason = _("The transaction amount is too small to pay the fee");
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int j = 0; j < nSplitBlock; j++) {
|
||||
if (j == nSplitBlock - 1) {
|
||||
uint64_t nRemainder = nAmount % nSplitBlock;
|
||||
txNew.vout.push_back(CTxOut((nAmount / nSplitBlock) + nRemainder, s.first));
|
||||
} else
|
||||
txNew.vout.push_back(CTxOut(s.second / nSplitBlock, s.first));
|
||||
txNew.vout.push_back(CTxOut(nAmount / nSplitBlock, s.first));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -500,7 +500,8 @@ public:
|
||||
const CCoinControl* coinControl = NULL,
|
||||
AvailableCoinsType coin_type = ALL_COINS,
|
||||
bool useIX = false,
|
||||
CAmount nFeePay = 0);
|
||||
CAmount nFeePay = 0,
|
||||
const std::set<int>* setSubtractFeeFromOutputs = NULL);
|
||||
bool CreateTransaction(CScript scriptPubKey, const CAmount& nValue, CWalletTx& wtxNew, CReserveKey& reservekey, CAmount& nFeeRet, std::string& strFailReason, const CCoinControl* coinControl = NULL, AvailableCoinsType coin_type = ALL_COINS, bool useIX = false, CAmount nFeePay = 0);
|
||||
bool CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey, std::string strCommand = "tx");
|
||||
bool AddAccountingEntry(const CAccountingEntry&, CWalletDB & pwalletdb);
|
||||
|
||||
Reference in New Issue
Block a user