Merge pull request #2628 from patricklodder/1.14.5-univalue-update
univalue: update to latest version
This commit is contained in:
commit
9e6a8bc5c4
|
@ -0,0 +1,47 @@
|
|||
#!/bin/sh
|
||||
# Copyright (c) 2017-2020 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
# This simple script checks for commits beginning with: scripted-diff:
|
||||
# If found, looks for a script between the lines -BEGIN VERIFY SCRIPT- and
|
||||
# -END VERIFY SCRIPT-. If no ending is found, it reads until the end of the
|
||||
# commit message.
|
||||
|
||||
# The resulting script should exactly transform the previous commit into the current
|
||||
# one. Any remaining diff signals an error.
|
||||
|
||||
export LC_ALL=C
|
||||
if test -z $1; then
|
||||
echo "Usage: $0 <commit>..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
RET=0
|
||||
PREV_BRANCH=$(git name-rev --name-only HEAD)
|
||||
PREV_HEAD=$(git rev-parse HEAD)
|
||||
for commit in $(git rev-list --reverse $1); do
|
||||
if git rev-list -n 1 --pretty="%s" $commit | grep -q "^scripted-diff:"; then
|
||||
git checkout --quiet $commit^ || exit
|
||||
SCRIPT="$(git rev-list --format=%b -n1 $commit | sed '/^-BEGIN VERIFY SCRIPT-$/,/^-END VERIFY SCRIPT-$/{//!b};d')"
|
||||
if test -z "$SCRIPT"; then
|
||||
echo "Error: missing script for: $commit"
|
||||
echo "Failed"
|
||||
RET=1
|
||||
else
|
||||
echo "Running script for: $commit"
|
||||
echo "$SCRIPT"
|
||||
(eval "$SCRIPT")
|
||||
git --no-pager diff --exit-code $commit && echo "OK" || (echo "Failed"; false) || RET=1
|
||||
fi
|
||||
git reset --quiet --hard HEAD
|
||||
else
|
||||
if git rev-list "--format=%b" -n1 $commit | grep -q '^-\(BEGIN\|END\)[ a-zA-Z]*-$'; then
|
||||
echo "Error: script block marker but no scripted-diff in title of commit $commit"
|
||||
echo "Failed"
|
||||
RET=1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
git checkout --quiet $PREV_BRANCH 2>/dev/null || git checkout --quiet $PREV_HEAD
|
||||
exit $RET
|
16
src/rest.cpp
16
src/rest.cpp
|
@ -568,24 +568,24 @@ static bool rest_getutxos(HTTPRequest* req, const std::string& strURIPart)
|
|||
|
||||
// pack in some essentials
|
||||
// use more or less the same output as mentioned in Bip64
|
||||
objGetUTXOResponse.push_back(Pair("chainHeight", chainActive.Height()));
|
||||
objGetUTXOResponse.push_back(Pair("chaintipHash", chainActive.Tip()->GetBlockHash().GetHex()));
|
||||
objGetUTXOResponse.push_back(Pair("bitmap", bitmapStringRepresentation));
|
||||
objGetUTXOResponse.pushKV("chainHeight", chainActive.Height());
|
||||
objGetUTXOResponse.pushKV("chaintipHash", chainActive.Tip()->GetBlockHash().GetHex());
|
||||
objGetUTXOResponse.pushKV("bitmap", bitmapStringRepresentation);
|
||||
|
||||
UniValue utxos(UniValue::VARR);
|
||||
BOOST_FOREACH (const CCoin& coin, outs) {
|
||||
UniValue utxo(UniValue::VOBJ);
|
||||
utxo.push_back(Pair("txvers", (int32_t)coin.nTxVer));
|
||||
utxo.push_back(Pair("height", (int32_t)coin.nHeight));
|
||||
utxo.push_back(Pair("value", ValueFromAmount(coin.out.nValue)));
|
||||
utxo.pushKV("txvers", (int32_t)coin.nTxVer);
|
||||
utxo.pushKV("height", (int32_t)coin.nHeight);
|
||||
utxo.pushKV("value", ValueFromAmount(coin.out.nValue));
|
||||
|
||||
// include the script in a json output
|
||||
UniValue o(UniValue::VOBJ);
|
||||
ScriptPubKeyToJSON(coin.out.scriptPubKey, o, true);
|
||||
utxo.push_back(Pair("scriptPubKey", o));
|
||||
utxo.pushKV("scriptPubKey", o);
|
||||
utxos.push_back(utxo);
|
||||
}
|
||||
objGetUTXOResponse.push_back(Pair("utxos", utxos));
|
||||
objGetUTXOResponse.pushKV("utxos", utxos);
|
||||
|
||||
// return json string
|
||||
std::string strJSON = objGetUTXOResponse.write() + "\n";
|
||||
|
|
|
@ -81,32 +81,32 @@ UniValue AuxpowToJSON(const CAuxPow& auxpow)
|
|||
|
||||
{
|
||||
UniValue tx(UniValue::VOBJ);
|
||||
tx.push_back(Pair("hex", EncodeHexTx(auxpow)));
|
||||
tx.pushKV("hex", EncodeHexTx(auxpow));
|
||||
TxToJSON(auxpow, auxpow.parentBlock.GetHash(), tx);
|
||||
result.push_back(Pair("tx", tx));
|
||||
result.pushKV("tx", tx);
|
||||
}
|
||||
|
||||
result.push_back(Pair("index", auxpow.nIndex));
|
||||
result.push_back(Pair("chainindex", auxpow.nChainIndex));
|
||||
result.pushKV("index", auxpow.nIndex);
|
||||
result.pushKV("chainindex", auxpow.nChainIndex);
|
||||
|
||||
{
|
||||
UniValue branch(UniValue::VARR);
|
||||
BOOST_FOREACH(const uint256& node, auxpow.vMerkleBranch)
|
||||
branch.push_back(node.GetHex());
|
||||
result.push_back(Pair("merklebranch", branch));
|
||||
result.pushKV("merklebranch", branch);
|
||||
}
|
||||
|
||||
{
|
||||
UniValue branch(UniValue::VARR);
|
||||
BOOST_FOREACH(const uint256& node, auxpow.vChainMerkleBranch)
|
||||
branch.push_back(node.GetHex());
|
||||
result.push_back(Pair("chainmerklebranch", branch));
|
||||
result.pushKV("chainmerklebranch", branch);
|
||||
}
|
||||
|
||||
CDataStream ssParent(SER_NETWORK, PROTOCOL_VERSION);
|
||||
ssParent << auxpow.parentBlock;
|
||||
const std::string strHex = HexStr(ssParent.begin(), ssParent.end());
|
||||
result.push_back(Pair("parentblock", strHex));
|
||||
result.pushKV("parentblock", strHex);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -114,47 +114,47 @@ UniValue AuxpowToJSON(const CAuxPow& auxpow)
|
|||
UniValue blockheaderToJSON(const CBlockIndex* blockindex)
|
||||
{
|
||||
UniValue result(UniValue::VOBJ);
|
||||
result.push_back(Pair("hash", blockindex->GetBlockHash().GetHex()));
|
||||
result.pushKV("hash", blockindex->GetBlockHash().GetHex());
|
||||
int confirmations = -1;
|
||||
// Only report confirmations if the block is on the main chain
|
||||
if (chainActive.Contains(blockindex))
|
||||
confirmations = chainActive.Height() - blockindex->nHeight + 1;
|
||||
result.push_back(Pair("confirmations", confirmations));
|
||||
result.push_back(Pair("height", blockindex->nHeight));
|
||||
result.push_back(Pair("version", blockindex->nVersion));
|
||||
result.push_back(Pair("versionHex", strprintf("%08x", blockindex->nVersion)));
|
||||
result.push_back(Pair("merkleroot", blockindex->hashMerkleRoot.GetHex()));
|
||||
result.push_back(Pair("time", (int64_t)blockindex->nTime));
|
||||
result.push_back(Pair("mediantime", (int64_t)blockindex->GetMedianTimePast()));
|
||||
result.push_back(Pair("nonce", (uint64_t)blockindex->nNonce));
|
||||
result.push_back(Pair("bits", strprintf("%08x", blockindex->nBits)));
|
||||
result.push_back(Pair("difficulty", GetDifficulty(blockindex)));
|
||||
result.push_back(Pair("chainwork", blockindex->nChainWork.GetHex()));
|
||||
result.pushKV("confirmations", confirmations);
|
||||
result.pushKV("height", blockindex->nHeight);
|
||||
result.pushKV("version", blockindex->nVersion);
|
||||
result.pushKV("versionHex", strprintf("%08x", blockindex->nVersion));
|
||||
result.pushKV("merkleroot", blockindex->hashMerkleRoot.GetHex());
|
||||
result.pushKV("time", (int64_t)blockindex->nTime);
|
||||
result.pushKV("mediantime", (int64_t)blockindex->GetMedianTimePast());
|
||||
result.pushKV("nonce", (uint64_t)blockindex->nNonce);
|
||||
result.pushKV("bits", strprintf("%08x", blockindex->nBits));
|
||||
result.pushKV("difficulty", GetDifficulty(blockindex));
|
||||
result.pushKV("chainwork", blockindex->nChainWork.GetHex());
|
||||
|
||||
if (blockindex->pprev)
|
||||
result.push_back(Pair("previousblockhash", blockindex->pprev->GetBlockHash().GetHex()));
|
||||
result.pushKV("previousblockhash", blockindex->pprev->GetBlockHash().GetHex());
|
||||
CBlockIndex *pnext = chainActive.Next(blockindex);
|
||||
if (pnext)
|
||||
result.push_back(Pair("nextblockhash", pnext->GetBlockHash().GetHex()));
|
||||
result.pushKV("nextblockhash", pnext->GetBlockHash().GetHex());
|
||||
return result;
|
||||
}
|
||||
|
||||
UniValue blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool txDetails = false)
|
||||
{
|
||||
UniValue result(UniValue::VOBJ);
|
||||
result.push_back(Pair("hash", blockindex->GetBlockHash().GetHex()));
|
||||
result.pushKV("hash", blockindex->GetBlockHash().GetHex());
|
||||
int confirmations = -1;
|
||||
// Only report confirmations if the block is on the main chain
|
||||
if (chainActive.Contains(blockindex))
|
||||
confirmations = chainActive.Height() - blockindex->nHeight + 1;
|
||||
result.push_back(Pair("confirmations", confirmations));
|
||||
result.push_back(Pair("strippedsize", (int)::GetSerializeSize(block, SER_NETWORK, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS)));
|
||||
result.push_back(Pair("size", (int)::GetSerializeSize(block, SER_NETWORK, PROTOCOL_VERSION)));
|
||||
result.push_back(Pair("weight", (int)::GetBlockWeight(block)));
|
||||
result.push_back(Pair("height", blockindex->nHeight));
|
||||
result.push_back(Pair("version", block.nVersion));
|
||||
result.push_back(Pair("versionHex", strprintf("%08x", block.nVersion)));
|
||||
result.push_back(Pair("merkleroot", block.hashMerkleRoot.GetHex()));
|
||||
result.pushKV("confirmations", confirmations);
|
||||
result.pushKV("strippedsize", (int)::GetSerializeSize(block, SER_NETWORK, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS));
|
||||
result.pushKV("size", (int)::GetSerializeSize(block, SER_NETWORK, PROTOCOL_VERSION));
|
||||
result.pushKV("weight", (int)::GetBlockWeight(block));
|
||||
result.pushKV("height", blockindex->nHeight);
|
||||
result.pushKV("version", block.nVersion);
|
||||
result.pushKV("versionHex", strprintf("%08x", block.nVersion));
|
||||
result.pushKV("merkleroot", block.hashMerkleRoot.GetHex());
|
||||
UniValue txs(UniValue::VARR);
|
||||
for(const auto& tx : block.vtx)
|
||||
{
|
||||
|
@ -167,22 +167,22 @@ UniValue blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool tx
|
|||
else
|
||||
txs.push_back(tx->GetHash().GetHex());
|
||||
}
|
||||
result.push_back(Pair("tx", txs));
|
||||
result.push_back(Pair("time", block.GetBlockTime()));
|
||||
result.push_back(Pair("mediantime", (int64_t)blockindex->GetMedianTimePast()));
|
||||
result.push_back(Pair("nonce", (uint64_t)block.nNonce));
|
||||
result.push_back(Pair("bits", strprintf("%08x", block.nBits)));
|
||||
result.push_back(Pair("difficulty", GetDifficulty(blockindex)));
|
||||
result.push_back(Pair("chainwork", blockindex->nChainWork.GetHex()));
|
||||
result.pushKV("tx", txs);
|
||||
result.pushKV("time", block.GetBlockTime());
|
||||
result.pushKV("mediantime", (int64_t)blockindex->GetMedianTimePast());
|
||||
result.pushKV("nonce", (uint64_t)block.nNonce);
|
||||
result.pushKV("bits", strprintf("%08x", block.nBits));
|
||||
result.pushKV("difficulty", GetDifficulty(blockindex));
|
||||
result.pushKV("chainwork", blockindex->nChainWork.GetHex());
|
||||
|
||||
if (block.auxpow)
|
||||
result.push_back(Pair("auxpow", AuxpowToJSON(*block.auxpow)));
|
||||
result.pushKV("auxpow", AuxpowToJSON(*block.auxpow));
|
||||
|
||||
if (blockindex->pprev)
|
||||
result.push_back(Pair("previousblockhash", blockindex->pprev->GetBlockHash().GetHex()));
|
||||
result.pushKV("previousblockhash", blockindex->pprev->GetBlockHash().GetHex());
|
||||
CBlockIndex *pnext = chainActive.Next(blockindex);
|
||||
if (pnext)
|
||||
result.push_back(Pair("nextblockhash", pnext->GetBlockHash().GetHex()));
|
||||
result.pushKV("nextblockhash", pnext->GetBlockHash().GetHex());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -263,8 +263,8 @@ UniValue waitfornewblock(const JSONRPCRequest& request)
|
|||
block = latestblock;
|
||||
}
|
||||
UniValue ret(UniValue::VOBJ);
|
||||
ret.push_back(Pair("hash", block.hash.GetHex()));
|
||||
ret.push_back(Pair("height", block.height));
|
||||
ret.pushKV("hash", block.hash.GetHex());
|
||||
ret.pushKV("height", block.height);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -305,8 +305,8 @@ UniValue waitforblock(const JSONRPCRequest& request)
|
|||
}
|
||||
|
||||
UniValue ret(UniValue::VOBJ);
|
||||
ret.push_back(Pair("hash", block.hash.GetHex()));
|
||||
ret.push_back(Pair("height", block.height));
|
||||
ret.pushKV("hash", block.hash.GetHex());
|
||||
ret.pushKV("height", block.height);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -347,8 +347,8 @@ UniValue waitforblockheight(const JSONRPCRequest& request)
|
|||
block = latestblock;
|
||||
}
|
||||
UniValue ret(UniValue::VOBJ);
|
||||
ret.push_back(Pair("hash", block.hash.GetHex()));
|
||||
ret.push_back(Pair("height", block.height));
|
||||
ret.pushKV("hash", block.hash.GetHex());
|
||||
ret.pushKV("height", block.height);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -393,19 +393,19 @@ void entryToJSON(UniValue &info, const CTxMemPoolEntry &e)
|
|||
{
|
||||
AssertLockHeld(mempool.cs);
|
||||
|
||||
info.push_back(Pair("size", (int)e.GetTxSize()));
|
||||
info.push_back(Pair("fee", ValueFromAmount(e.GetFee())));
|
||||
info.push_back(Pair("modifiedfee", ValueFromAmount(e.GetModifiedFee())));
|
||||
info.push_back(Pair("time", e.GetTime()));
|
||||
info.push_back(Pair("height", (int)e.GetHeight()));
|
||||
info.push_back(Pair("startingpriority", e.GetPriority(e.GetHeight())));
|
||||
info.push_back(Pair("currentpriority", e.GetPriority(chainActive.Height())));
|
||||
info.push_back(Pair("descendantcount", e.GetCountWithDescendants()));
|
||||
info.push_back(Pair("descendantsize", e.GetSizeWithDescendants()));
|
||||
info.push_back(Pair("descendantfees", e.GetModFeesWithDescendants()));
|
||||
info.push_back(Pair("ancestorcount", e.GetCountWithAncestors()));
|
||||
info.push_back(Pair("ancestorsize", e.GetSizeWithAncestors()));
|
||||
info.push_back(Pair("ancestorfees", e.GetModFeesWithAncestors()));
|
||||
info.pushKV("size", (int)e.GetTxSize());
|
||||
info.pushKV("fee", ValueFromAmount(e.GetFee()));
|
||||
info.pushKV("modifiedfee", ValueFromAmount(e.GetModifiedFee()));
|
||||
info.pushKV("time", e.GetTime());
|
||||
info.pushKV("height", (int)e.GetHeight());
|
||||
info.pushKV("startingpriority", e.GetPriority(e.GetHeight()));
|
||||
info.pushKV("currentpriority", e.GetPriority(chainActive.Height()));
|
||||
info.pushKV("descendantcount", e.GetCountWithDescendants());
|
||||
info.pushKV("descendantsize", e.GetSizeWithDescendants());
|
||||
info.pushKV("descendantfees", e.GetModFeesWithDescendants());
|
||||
info.pushKV("ancestorcount", e.GetCountWithAncestors());
|
||||
info.pushKV("ancestorsize", e.GetSizeWithAncestors());
|
||||
info.pushKV("ancestorfees", e.GetModFeesWithAncestors());
|
||||
const CTransaction& tx = e.GetTx();
|
||||
set<string> setDepends;
|
||||
BOOST_FOREACH(const CTxIn& txin, tx.vin)
|
||||
|
@ -420,7 +420,7 @@ void entryToJSON(UniValue &info, const CTxMemPoolEntry &e)
|
|||
depends.push_back(dep);
|
||||
}
|
||||
|
||||
info.push_back(Pair("depends", depends));
|
||||
info.pushKV("depends", depends);
|
||||
}
|
||||
|
||||
UniValue mempoolToJSON(bool fVerbose = false)
|
||||
|
@ -434,7 +434,7 @@ UniValue mempoolToJSON(bool fVerbose = false)
|
|||
const uint256& hash = e.GetTx().GetHash();
|
||||
UniValue info(UniValue::VOBJ);
|
||||
entryToJSON(info, e);
|
||||
o.push_back(Pair(hash.ToString(), info));
|
||||
o.pushKV(hash.ToString(), info);
|
||||
}
|
||||
return o;
|
||||
}
|
||||
|
@ -541,7 +541,7 @@ UniValue getmempoolancestors(const JSONRPCRequest& request)
|
|||
const uint256& _hash = e.GetTx().GetHash();
|
||||
UniValue info(UniValue::VOBJ);
|
||||
entryToJSON(info, e);
|
||||
o.push_back(Pair(_hash.ToString(), info));
|
||||
o.pushKV(_hash.ToString(), info);
|
||||
}
|
||||
return o;
|
||||
}
|
||||
|
@ -605,7 +605,7 @@ UniValue getmempooldescendants(const JSONRPCRequest& request)
|
|||
const uint256& _hash = e.GetTx().GetHash();
|
||||
UniValue info(UniValue::VOBJ);
|
||||
entryToJSON(info, e);
|
||||
o.push_back(Pair(_hash.ToString(), info));
|
||||
o.pushKV(_hash.ToString(), info);
|
||||
}
|
||||
return o;
|
||||
}
|
||||
|
@ -936,13 +936,13 @@ UniValue gettxoutsetinfo(const JSONRPCRequest& request)
|
|||
CCoinsStats stats;
|
||||
FlushStateToDisk();
|
||||
if (GetUTXOStats(pcoinsTip, stats)) {
|
||||
ret.push_back(Pair("height", (int64_t)stats.nHeight));
|
||||
ret.push_back(Pair("bestblock", stats.hashBlock.GetHex()));
|
||||
ret.push_back(Pair("transactions", (int64_t)stats.nTransactions));
|
||||
ret.push_back(Pair("txouts", (int64_t)stats.nTransactionOutputs));
|
||||
ret.push_back(Pair("bytes_serialized", (int64_t)stats.nSerializedSize));
|
||||
ret.push_back(Pair("hash_serialized", stats.hashSerialized.GetHex()));
|
||||
ret.push_back(Pair("total_amount", ValueFromAmount(stats.nTotalAmount)));
|
||||
ret.pushKV("height", (int64_t)stats.nHeight);
|
||||
ret.pushKV("bestblock", stats.hashBlock.GetHex());
|
||||
ret.pushKV("transactions", (int64_t)stats.nTransactions);
|
||||
ret.pushKV("txouts", (int64_t)stats.nTransactionOutputs);
|
||||
ret.pushKV("bytes_serialized", (int64_t)stats.nSerializedSize);
|
||||
ret.pushKV("hash_serialized", stats.hashSerialized.GetHex());
|
||||
ret.pushKV("total_amount", ValueFromAmount(stats.nTotalAmount));
|
||||
} else {
|
||||
throw JSONRPCError(RPC_INTERNAL_ERROR, "Unable to read UTXO set");
|
||||
}
|
||||
|
@ -1014,17 +1014,17 @@ UniValue gettxout(const JSONRPCRequest& request)
|
|||
|
||||
BlockMap::iterator it = mapBlockIndex.find(pcoinsTip->GetBestBlock());
|
||||
CBlockIndex *pindex = it->second;
|
||||
ret.push_back(Pair("bestblock", pindex->GetBlockHash().GetHex()));
|
||||
ret.pushKV("bestblock", pindex->GetBlockHash().GetHex());
|
||||
if ((unsigned int)coins.nHeight == MEMPOOL_HEIGHT)
|
||||
ret.push_back(Pair("confirmations", 0));
|
||||
ret.pushKV("confirmations", 0);
|
||||
else
|
||||
ret.push_back(Pair("confirmations", pindex->nHeight - coins.nHeight + 1));
|
||||
ret.push_back(Pair("value", ValueFromAmount(coins.vout[n].nValue)));
|
||||
ret.pushKV("confirmations", pindex->nHeight - coins.nHeight + 1);
|
||||
ret.pushKV("value", ValueFromAmount(coins.vout[n].nValue));
|
||||
UniValue o(UniValue::VOBJ);
|
||||
ScriptPubKeyToJSON(coins.vout[n].scriptPubKey, o, true);
|
||||
ret.push_back(Pair("scriptPubKey", o));
|
||||
ret.push_back(Pair("version", coins.nVersion));
|
||||
ret.push_back(Pair("coinbase", coins.fCoinBase));
|
||||
ret.pushKV("scriptPubKey", o);
|
||||
ret.pushKV("version", coins.nVersion);
|
||||
ret.pushKV("coinbase", coins.fCoinBase);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -1074,16 +1074,16 @@ static UniValue SoftForkMajorityDesc(int version, CBlockIndex* pindex, const Con
|
|||
activated = pindex->nHeight >= consensusParams.BIP65Height;
|
||||
break;
|
||||
}
|
||||
rv.push_back(Pair("status", activated));
|
||||
rv.pushKV("status", activated);
|
||||
return rv;
|
||||
}
|
||||
|
||||
static UniValue SoftForkDesc(const std::string &name, int version, CBlockIndex* pindex, const Consensus::Params& consensusParams)
|
||||
{
|
||||
UniValue rv(UniValue::VOBJ);
|
||||
rv.push_back(Pair("id", name));
|
||||
rv.push_back(Pair("version", version));
|
||||
rv.push_back(Pair("reject", SoftForkMajorityDesc(version, pindex, consensusParams)));
|
||||
rv.pushKV("id", name);
|
||||
rv.pushKV("version", version);
|
||||
rv.pushKV("reject", SoftForkMajorityDesc(version, pindex, consensusParams));
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -1092,19 +1092,19 @@ static UniValue BIP9SoftForkDesc(const Consensus::Params& consensusParams, Conse
|
|||
UniValue rv(UniValue::VOBJ);
|
||||
const ThresholdState thresholdState = VersionBitsTipState(consensusParams, id);
|
||||
switch (thresholdState) {
|
||||
case THRESHOLD_DEFINED: rv.push_back(Pair("status", "defined")); break;
|
||||
case THRESHOLD_STARTED: rv.push_back(Pair("status", "started")); break;
|
||||
case THRESHOLD_LOCKED_IN: rv.push_back(Pair("status", "locked_in")); break;
|
||||
case THRESHOLD_ACTIVE: rv.push_back(Pair("status", "active")); break;
|
||||
case THRESHOLD_FAILED: rv.push_back(Pair("status", "failed")); break;
|
||||
case THRESHOLD_DEFINED: rv.pushKV("status", "defined"); break;
|
||||
case THRESHOLD_STARTED: rv.pushKV("status", "started"); break;
|
||||
case THRESHOLD_LOCKED_IN: rv.pushKV("status", "locked_in"); break;
|
||||
case THRESHOLD_ACTIVE: rv.pushKV("status", "active"); break;
|
||||
case THRESHOLD_FAILED: rv.pushKV("status", "failed"); break;
|
||||
}
|
||||
if (THRESHOLD_STARTED == thresholdState)
|
||||
{
|
||||
rv.push_back(Pair("bit", consensusParams.vDeployments[id].bit));
|
||||
rv.pushKV("bit", consensusParams.vDeployments[id].bit);
|
||||
}
|
||||
rv.push_back(Pair("startTime", consensusParams.vDeployments[id].nStartTime));
|
||||
rv.push_back(Pair("timeout", consensusParams.vDeployments[id].nTimeout));
|
||||
rv.push_back(Pair("since", VersionBitsTipStateSinceHeight(consensusParams, id)));
|
||||
rv.pushKV("startTime", consensusParams.vDeployments[id].nStartTime);
|
||||
rv.pushKV("timeout", consensusParams.vDeployments[id].nTimeout);
|
||||
rv.pushKV("since", VersionBitsTipStateSinceHeight(consensusParams, id));
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -1114,7 +1114,7 @@ void BIP9SoftForkDescPushBack(UniValue& bip9_softforks, const std::string &name,
|
|||
// A timeout value of 0 guarantees a softfork will never be activated.
|
||||
// This is used when softfork codes are merged without specifying the deployment schedule.
|
||||
if (consensusParams.vDeployments[id].nTimeout > 0)
|
||||
bip9_softforks.push_back(Pair(name, BIP9SoftForkDesc(consensusParams, id)));
|
||||
bip9_softforks.pushKV(name, BIP9SoftForkDesc(consensusParams, id));
|
||||
}
|
||||
|
||||
UniValue getblockchaininfo(const JSONRPCRequest& request)
|
||||
|
@ -1166,17 +1166,17 @@ UniValue getblockchaininfo(const JSONRPCRequest& request)
|
|||
LOCK(cs_main);
|
||||
|
||||
UniValue obj(UniValue::VOBJ);
|
||||
obj.push_back(Pair("chain", Params().NetworkIDString()));
|
||||
obj.push_back(Pair("blocks", (int)chainActive.Height()));
|
||||
obj.push_back(Pair("headers", pindexBestHeader ? pindexBestHeader->nHeight : -1));
|
||||
obj.push_back(Pair("bestblockhash", chainActive.Tip()->GetBlockHash().GetHex()));
|
||||
obj.push_back(Pair("difficulty", (double)GetDifficulty()));
|
||||
obj.push_back(Pair("mediantime", (int64_t)chainActive.Tip()->GetMedianTimePast()));
|
||||
obj.push_back(Pair("verificationprogress", GuessVerificationProgress(Params().TxData(), chainActive.Tip())));
|
||||
obj.push_back(Pair("initialblockdownload", IsInitialBlockDownload()));
|
||||
obj.push_back(Pair("chainwork", chainActive.Tip()->nChainWork.GetHex()));
|
||||
obj.push_back(Pair("size_on_disk", CalculateCurrentUsage()));
|
||||
obj.push_back(Pair("pruned", fPruneMode));
|
||||
obj.pushKV("chain", Params().NetworkIDString());
|
||||
obj.pushKV("blocks", (int)chainActive.Height());
|
||||
obj.pushKV("headers", pindexBestHeader ? pindexBestHeader->nHeight : -1);
|
||||
obj.pushKV("bestblockhash", chainActive.Tip()->GetBlockHash().GetHex());
|
||||
obj.pushKV("difficulty", (double)GetDifficulty());
|
||||
obj.pushKV("mediantime", (int64_t)chainActive.Tip()->GetMedianTimePast());
|
||||
obj.pushKV("verificationprogress", GuessVerificationProgress(Params().TxData(), chainActive.Tip()));
|
||||
obj.pushKV("initialblockdownload", IsInitialBlockDownload());
|
||||
obj.pushKV("chainwork", chainActive.Tip()->nChainWork.GetHex());
|
||||
obj.pushKV("size_on_disk", CalculateCurrentUsage());
|
||||
obj.pushKV("pruned", fPruneMode);
|
||||
if (fPruneMode) {
|
||||
CBlockIndex* block = chainActive.Tip();
|
||||
assert(block);
|
||||
|
@ -1184,13 +1184,13 @@ UniValue getblockchaininfo(const JSONRPCRequest& request)
|
|||
block = block->pprev;
|
||||
}
|
||||
|
||||
obj.push_back(Pair("pruneheight", block->nHeight));
|
||||
obj.pushKV("pruneheight", block->nHeight);
|
||||
|
||||
// if 0, execution bypasses the whole if block.
|
||||
bool automatic_pruning = (GetArg("-prune", 0) != 1);
|
||||
obj.push_back(Pair("automatic_pruning", automatic_pruning));
|
||||
obj.pushKV("automatic_pruning", automatic_pruning);
|
||||
if (automatic_pruning) {
|
||||
obj.push_back(Pair("prune_target_size", nPruneTarget));
|
||||
obj.pushKV("prune_target_size", nPruneTarget);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1203,9 +1203,9 @@ UniValue getblockchaininfo(const JSONRPCRequest& request)
|
|||
softforks.push_back(SoftForkDesc("bip65", 4, tip, consensusParams));
|
||||
BIP9SoftForkDescPushBack(bip9_softforks, "csv", consensusParams, Consensus::DEPLOYMENT_CSV);
|
||||
BIP9SoftForkDescPushBack(bip9_softforks, "segwit", consensusParams, Consensus::DEPLOYMENT_SEGWIT);
|
||||
obj.push_back(Pair("softforks", softforks));
|
||||
obj.push_back(Pair("bip9_softforks", bip9_softforks));
|
||||
obj.push_back(Pair("warnings", GetWarnings("statusbar")));
|
||||
obj.pushKV("softforks", softforks);
|
||||
obj.pushKV("bip9_softforks", bip9_softforks);
|
||||
obj.pushKV("warnings", GetWarnings("statusbar"));
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
@ -1293,11 +1293,11 @@ UniValue getchaintips(const JSONRPCRequest& request)
|
|||
BOOST_FOREACH(const CBlockIndex* block, setTips)
|
||||
{
|
||||
UniValue obj(UniValue::VOBJ);
|
||||
obj.push_back(Pair("height", block->nHeight));
|
||||
obj.push_back(Pair("hash", block->phashBlock->GetHex()));
|
||||
obj.pushKV("height", block->nHeight);
|
||||
obj.pushKV("hash", block->phashBlock->GetHex());
|
||||
|
||||
const int branchLen = block->nHeight - chainActive.FindFork(block)->nHeight;
|
||||
obj.push_back(Pair("branchlen", branchLen));
|
||||
obj.pushKV("branchlen", branchLen);
|
||||
|
||||
string status;
|
||||
if (chainActive.Contains(block)) {
|
||||
|
@ -1319,7 +1319,7 @@ UniValue getchaintips(const JSONRPCRequest& request)
|
|||
// No clue.
|
||||
status = "unknown";
|
||||
}
|
||||
obj.push_back(Pair("status", status));
|
||||
obj.pushKV("status", status);
|
||||
|
||||
res.push_back(obj);
|
||||
}
|
||||
|
@ -1330,12 +1330,12 @@ UniValue getchaintips(const JSONRPCRequest& request)
|
|||
UniValue mempoolInfoToJSON()
|
||||
{
|
||||
UniValue ret(UniValue::VOBJ);
|
||||
ret.push_back(Pair("size", (int64_t) mempool.size()));
|
||||
ret.push_back(Pair("bytes", (int64_t) mempool.GetTotalTxSize()));
|
||||
ret.push_back(Pair("usage", (int64_t) mempool.DynamicMemoryUsage()));
|
||||
ret.pushKV("size", (int64_t) mempool.size());
|
||||
ret.pushKV("bytes", (int64_t) mempool.GetTotalTxSize());
|
||||
ret.pushKV("usage", (int64_t) mempool.DynamicMemoryUsage());
|
||||
size_t maxmempool = GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000;
|
||||
ret.push_back(Pair("maxmempool", (int64_t) maxmempool));
|
||||
ret.push_back(Pair("mempoolminfee", ValueFromAmount(mempool.GetMinFee(maxmempool).GetFeePerK())));
|
||||
ret.pushKV("maxmempool", (int64_t) maxmempool);
|
||||
ret.pushKV("mempoolminfee", ValueFromAmount(mempool.GetMinFee(maxmempool).GetFeePerK()));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -278,15 +278,15 @@ UniValue getmininginfo(const JSONRPCRequest& request)
|
|||
LOCK(cs_main);
|
||||
|
||||
UniValue obj(UniValue::VOBJ);
|
||||
obj.push_back(Pair("blocks", (int)chainActive.Height()));
|
||||
obj.push_back(Pair("currentblocksize", (uint64_t)nLastBlockSize));
|
||||
obj.push_back(Pair("currentblockweight", (uint64_t)nLastBlockWeight));
|
||||
obj.push_back(Pair("currentblocktx", (uint64_t)nLastBlockTx));
|
||||
obj.push_back(Pair("difficulty", (double)GetDifficulty()));
|
||||
obj.push_back(Pair("errors", GetWarnings("statusbar")));
|
||||
obj.push_back(Pair("networkhashps", getnetworkhashps(request)));
|
||||
obj.push_back(Pair("pooledtx", (uint64_t)mempool.size()));
|
||||
obj.push_back(Pair("chain", Params().NetworkIDString()));
|
||||
obj.pushKV("blocks", (int)chainActive.Height());
|
||||
obj.pushKV("currentblocksize", (uint64_t)nLastBlockSize);
|
||||
obj.pushKV("currentblockweight", (uint64_t)nLastBlockWeight);
|
||||
obj.pushKV("currentblocktx", (uint64_t)nLastBlockTx);
|
||||
obj.pushKV("difficulty", (double)GetDifficulty());
|
||||
obj.pushKV("errors", GetWarnings("statusbar"));
|
||||
obj.pushKV("networkhashps", getnetworkhashps(request));
|
||||
obj.pushKV("pooledtx", (uint64_t)mempool.size());
|
||||
obj.pushKV("chain", Params().NetworkIDString());
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
@ -617,9 +617,9 @@ UniValue getblocktemplate(const JSONRPCRequest& request)
|
|||
|
||||
UniValue entry(UniValue::VOBJ);
|
||||
|
||||
entry.push_back(Pair("data", EncodeHexTx(tx)));
|
||||
entry.push_back(Pair("txid", txHash.GetHex()));
|
||||
entry.push_back(Pair("hash", tx.GetWitnessHash().GetHex()));
|
||||
entry.pushKV("data", EncodeHexTx(tx));
|
||||
entry.pushKV("txid", txHash.GetHex());
|
||||
entry.pushKV("hash", tx.GetWitnessHash().GetHex());
|
||||
|
||||
UniValue deps(UniValue::VARR);
|
||||
BOOST_FOREACH (const CTxIn &in, tx.vin)
|
||||
|
@ -627,23 +627,23 @@ UniValue getblocktemplate(const JSONRPCRequest& request)
|
|||
if (setTxIndex.count(in.prevout.hash))
|
||||
deps.push_back(setTxIndex[in.prevout.hash]);
|
||||
}
|
||||
entry.push_back(Pair("depends", deps));
|
||||
entry.pushKV("depends", deps);
|
||||
|
||||
int index_in_template = i - 1;
|
||||
entry.push_back(Pair("fee", pblocktemplate->vTxFees[index_in_template]));
|
||||
entry.pushKV("fee", pblocktemplate->vTxFees[index_in_template]);
|
||||
int64_t nTxSigOps = pblocktemplate->vTxSigOpsCost[index_in_template];
|
||||
if (fPreSegWit) {
|
||||
assert(nTxSigOps % WITNESS_SCALE_FACTOR == 0);
|
||||
nTxSigOps /= WITNESS_SCALE_FACTOR;
|
||||
}
|
||||
entry.push_back(Pair("sigops", nTxSigOps));
|
||||
entry.push_back(Pair("weight", GetTransactionWeight(tx)));
|
||||
entry.pushKV("sigops", nTxSigOps);
|
||||
entry.pushKV("weight", GetTransactionWeight(tx));
|
||||
|
||||
transactions.push_back(entry);
|
||||
}
|
||||
|
||||
UniValue aux(UniValue::VOBJ);
|
||||
aux.push_back(Pair("flags", HexStr(COINBASE_FLAGS.begin(), COINBASE_FLAGS.end())));
|
||||
aux.pushKV("flags", HexStr(COINBASE_FLAGS.begin(), COINBASE_FLAGS.end()));
|
||||
|
||||
arith_uint256 hashTarget = arith_uint256().SetCompact(pblock->nBits);
|
||||
|
||||
|
@ -653,7 +653,7 @@ UniValue getblocktemplate(const JSONRPCRequest& request)
|
|||
aMutable.push_back("prevblock");
|
||||
|
||||
UniValue result(UniValue::VOBJ);
|
||||
result.push_back(Pair("capabilities", aCaps));
|
||||
result.pushKV("capabilities", aCaps);
|
||||
|
||||
UniValue aRules(UniValue::VARR);
|
||||
UniValue vbavailable(UniValue::VOBJ);
|
||||
|
@ -674,7 +674,7 @@ UniValue getblocktemplate(const JSONRPCRequest& request)
|
|||
case THRESHOLD_STARTED:
|
||||
{
|
||||
const struct BIP9DeploymentInfo& vbinfo = VersionBitsDeploymentInfo[pos];
|
||||
vbavailable.push_back(Pair(gbt_vb_name(pos), consensusParams.vDeployments[pos].bit));
|
||||
vbavailable.pushKV(gbt_vb_name(pos), consensusParams.vDeployments[pos].bit);
|
||||
if (setClientRules.find(vbinfo.name) == setClientRules.end()) {
|
||||
if (!vbinfo.gbt_force) {
|
||||
// If the client doesn't support this, don't indicate it in the [default] version
|
||||
|
@ -699,10 +699,10 @@ UniValue getblocktemplate(const JSONRPCRequest& request)
|
|||
}
|
||||
}
|
||||
}
|
||||
result.push_back(Pair("version", pblock->nVersion));
|
||||
result.push_back(Pair("rules", aRules));
|
||||
result.push_back(Pair("vbavailable", vbavailable));
|
||||
result.push_back(Pair("vbrequired", int(0)));
|
||||
result.pushKV("version", pblock->nVersion);
|
||||
result.pushKV("rules", aRules);
|
||||
result.pushKV("vbavailable", vbavailable);
|
||||
result.pushKV("vbrequired", int(0));
|
||||
|
||||
if (nMaxVersionPreVB >= 2) {
|
||||
// If VB is supported by the client, nMaxVersionPreVB is -1, so we won't get here
|
||||
|
@ -712,33 +712,33 @@ UniValue getblocktemplate(const JSONRPCRequest& request)
|
|||
aMutable.push_back("version/force");
|
||||
}
|
||||
|
||||
result.push_back(Pair("previousblockhash", pblock->hashPrevBlock.GetHex()));
|
||||
result.push_back(Pair("transactions", transactions));
|
||||
result.push_back(Pair("coinbaseaux", aux));
|
||||
result.push_back(Pair("coinbasevalue", (int64_t)pblock->vtx[0]->vout[0].nValue));
|
||||
result.push_back(Pair("longpollid", chainActive.Tip()->GetBlockHash().GetHex() + i64tostr(nTransactionsUpdatedLast)));
|
||||
result.push_back(Pair("target", hashTarget.GetHex()));
|
||||
result.push_back(Pair("mintime", (int64_t)pindexPrev->GetMedianTimePast()+1));
|
||||
result.push_back(Pair("mutable", aMutable));
|
||||
result.push_back(Pair("noncerange", "00000000ffffffff"));
|
||||
result.pushKV("previousblockhash", pblock->hashPrevBlock.GetHex());
|
||||
result.pushKV("transactions", transactions);
|
||||
result.pushKV("coinbaseaux", aux);
|
||||
result.pushKV("coinbasevalue", (int64_t)pblock->vtx[0]->vout[0].nValue);
|
||||
result.pushKV("longpollid", chainActive.Tip()->GetBlockHash().GetHex() + i64tostr(nTransactionsUpdatedLast));
|
||||
result.pushKV("target", hashTarget.GetHex());
|
||||
result.pushKV("mintime", (int64_t)pindexPrev->GetMedianTimePast()+1);
|
||||
result.pushKV("mutable", aMutable);
|
||||
result.pushKV("noncerange", "00000000ffffffff");
|
||||
int64_t nSigOpLimit = MAX_BLOCK_SIGOPS_COST;
|
||||
if (fPreSegWit) {
|
||||
assert(nSigOpLimit % WITNESS_SCALE_FACTOR == 0);
|
||||
nSigOpLimit /= WITNESS_SCALE_FACTOR;
|
||||
}
|
||||
result.push_back(Pair("sigoplimit", nSigOpLimit));
|
||||
result.pushKV("sigoplimit", nSigOpLimit);
|
||||
if (fPreSegWit) {
|
||||
result.push_back(Pair("sizelimit", (int64_t)MAX_BLOCK_BASE_SIZE));
|
||||
result.pushKV("sizelimit", (int64_t)MAX_BLOCK_BASE_SIZE);
|
||||
} else {
|
||||
result.push_back(Pair("sizelimit", (int64_t)MAX_BLOCK_SERIALIZED_SIZE));
|
||||
result.push_back(Pair("weightlimit", (int64_t)MAX_BLOCK_WEIGHT));
|
||||
result.pushKV("sizelimit", (int64_t)MAX_BLOCK_SERIALIZED_SIZE);
|
||||
result.pushKV("weightlimit", (int64_t)MAX_BLOCK_WEIGHT);
|
||||
}
|
||||
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.pushKV("curtime", pblock->GetBlockTime());
|
||||
result.pushKV("bits", strprintf("%08x", pblock->nBits));
|
||||
result.pushKV("height", (int64_t)(pindexPrev->nHeight+1));
|
||||
|
||||
if (!pblocktemplate->vchCoinbaseCommitment.empty() && fSupportsSegwit) {
|
||||
result.push_back(Pair("default_witness_commitment", HexStr(pblocktemplate->vchCoinbaseCommitment.begin(), pblocktemplate->vchCoinbaseCommitment.end())));
|
||||
result.pushKV("default_witness_commitment", HexStr(pblocktemplate->vchCoinbaseCommitment.begin(), pblocktemplate->vchCoinbaseCommitment.end()));
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -925,8 +925,8 @@ UniValue estimatesmartfee(const JSONRPCRequest& request)
|
|||
UniValue result(UniValue::VOBJ);
|
||||
int answerFound;
|
||||
CFeeRate feeRate = mempool.estimateSmartFee(nBlocks, &answerFound);
|
||||
result.push_back(Pair("feerate", feeRate == CFeeRate(0) ? -1.0 : ValueFromAmount(feeRate.GetFeePerK())));
|
||||
result.push_back(Pair("blocks", answerFound));
|
||||
result.pushKV("feerate", feeRate == CFeeRate(0) ? -1.0 : ValueFromAmount(feeRate.GetFeePerK()));
|
||||
result.pushKV("blocks", answerFound);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -961,8 +961,8 @@ UniValue estimatesmartpriority(const JSONRPCRequest& request)
|
|||
UniValue result(UniValue::VOBJ);
|
||||
int answerFound;
|
||||
double priority = mempool.estimateSmartPriority(nBlocks, &answerFound);
|
||||
result.push_back(Pair("priority", priority));
|
||||
result.push_back(Pair("blocks", answerFound));
|
||||
result.pushKV("priority", priority);
|
||||
result.pushKV("blocks", answerFound);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -1091,13 +1091,13 @@ UniValue getauxblockbip22(const JSONRPCRequest& request)
|
|||
throw std::runtime_error("invalid difficulty bits in block");
|
||||
|
||||
UniValue result(UniValue::VOBJ);
|
||||
result.push_back(Pair("hash", pblock->GetHash().GetHex()));
|
||||
result.push_back(Pair("chainid", pblock->GetChainId()));
|
||||
result.push_back(Pair("previousblockhash", pblock->hashPrevBlock.GetHex()));
|
||||
result.push_back(Pair("coinbasevalue", (int64_t)pblock->vtx[0]->vout[0].nValue));
|
||||
result.push_back(Pair("bits", strprintf("%08x", pblock->nBits)));
|
||||
result.push_back(Pair("height", static_cast<int64_t> (pindexPrev->nHeight + 1)));
|
||||
result.push_back(Pair("target", HexStr(BEGIN(target), END(target))));
|
||||
result.pushKV("hash", pblock->GetHash().GetHex());
|
||||
result.pushKV("chainid", pblock->GetChainId());
|
||||
result.pushKV("previousblockhash", pblock->hashPrevBlock.GetHex());
|
||||
result.pushKV("coinbasevalue", (int64_t)pblock->vtx[0]->vout[0].nValue);
|
||||
result.pushKV("bits", strprintf("%08x", pblock->nBits));
|
||||
result.pushKV("height", static_cast<int64_t> (pindexPrev->nHeight + 1));
|
||||
result.pushKV("target", HexStr(BEGIN(target), END(target)));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -79,32 +79,32 @@ UniValue getinfo(const JSONRPCRequest& request)
|
|||
GetProxy(NET_IPV4, proxy);
|
||||
|
||||
UniValue obj(UniValue::VOBJ);
|
||||
obj.push_back(Pair("version", CLIENT_VERSION));
|
||||
obj.push_back(Pair("protocolversion", PROTOCOL_VERSION));
|
||||
obj.pushKV("version", CLIENT_VERSION);
|
||||
obj.pushKV("protocolversion", PROTOCOL_VERSION);
|
||||
#ifdef ENABLE_WALLET
|
||||
if (pwalletMain) {
|
||||
obj.push_back(Pair("walletversion", pwalletMain->GetVersion()));
|
||||
obj.push_back(Pair("balance", ValueFromAmount(pwalletMain->GetBalance())));
|
||||
obj.pushKV("walletversion", pwalletMain->GetVersion());
|
||||
obj.pushKV("balance", ValueFromAmount(pwalletMain->GetBalance()));
|
||||
}
|
||||
#endif
|
||||
obj.push_back(Pair("blocks", (int)chainActive.Height()));
|
||||
obj.push_back(Pair("timeoffset", GetTimeOffset()));
|
||||
obj.pushKV("blocks", (int)chainActive.Height());
|
||||
obj.pushKV("timeoffset", GetTimeOffset());
|
||||
if(g_connman)
|
||||
obj.push_back(Pair("connections", (int)g_connman->GetNodeCount(CConnman::CONNECTIONS_ALL)));
|
||||
obj.push_back(Pair("proxy", (proxy.IsValid() ? proxy.proxy.ToStringIPPort() : string())));
|
||||
obj.push_back(Pair("difficulty", (double)GetDifficulty()));
|
||||
obj.push_back(Pair("testnet", Params().NetworkIDString() == CBaseChainParams::TESTNET));
|
||||
obj.pushKV("connections", (int)g_connman->GetNodeCount(CConnman::CONNECTIONS_ALL));
|
||||
obj.pushKV("proxy", (proxy.IsValid() ? proxy.proxy.ToStringIPPort() : string()));
|
||||
obj.pushKV("difficulty", (double)GetDifficulty());
|
||||
obj.pushKV("testnet", Params().NetworkIDString() == CBaseChainParams::TESTNET);
|
||||
#ifdef ENABLE_WALLET
|
||||
if (pwalletMain) {
|
||||
obj.push_back(Pair("keypoololdest", pwalletMain->GetOldestKeyPoolTime()));
|
||||
obj.push_back(Pair("keypoolsize", (int)pwalletMain->GetKeyPoolSize()));
|
||||
obj.pushKV("keypoololdest", pwalletMain->GetOldestKeyPoolTime());
|
||||
obj.pushKV("keypoolsize", (int)pwalletMain->GetKeyPoolSize());
|
||||
}
|
||||
if (pwalletMain && pwalletMain->IsCrypted())
|
||||
obj.push_back(Pair("unlocked_until", nWalletUnlockTime));
|
||||
obj.push_back(Pair("paytxfee", ValueFromAmount(payTxFee.GetFeePerK())));
|
||||
obj.pushKV("unlocked_until", nWalletUnlockTime);
|
||||
obj.pushKV("paytxfee", ValueFromAmount(payTxFee.GetFeePerK()));
|
||||
#endif
|
||||
obj.push_back(Pair("relayfee", ValueFromAmount(::minRelayTxFeeRate.GetFeePerK())));
|
||||
obj.push_back(Pair("errors", GetWarnings("statusbar")));
|
||||
obj.pushKV("relayfee", ValueFromAmount(::minRelayTxFeeRate.GetFeePerK()));
|
||||
obj.pushKV("errors", GetWarnings("statusbar"));
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
@ -117,10 +117,10 @@ public:
|
|||
UniValue operator()(const CKeyID &keyID) const {
|
||||
UniValue obj(UniValue::VOBJ);
|
||||
CPubKey vchPubKey;
|
||||
obj.push_back(Pair("isscript", false));
|
||||
obj.pushKV("isscript", false);
|
||||
if (pwalletMain && pwalletMain->GetPubKey(keyID, vchPubKey)) {
|
||||
obj.push_back(Pair("pubkey", HexStr(vchPubKey)));
|
||||
obj.push_back(Pair("iscompressed", vchPubKey.IsCompressed()));
|
||||
obj.pushKV("pubkey", HexStr(vchPubKey));
|
||||
obj.pushKV("iscompressed", vchPubKey.IsCompressed());
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
@ -128,20 +128,20 @@ public:
|
|||
UniValue operator()(const CScriptID &scriptID) const {
|
||||
UniValue obj(UniValue::VOBJ);
|
||||
CScript subscript;
|
||||
obj.push_back(Pair("isscript", true));
|
||||
obj.pushKV("isscript", true);
|
||||
if (pwalletMain && pwalletMain->GetCScript(scriptID, subscript)) {
|
||||
std::vector<CTxDestination> addresses;
|
||||
txnouttype whichType;
|
||||
int nRequired;
|
||||
ExtractDestinations(subscript, whichType, addresses, nRequired);
|
||||
obj.push_back(Pair("script", GetTxnOutputType(whichType)));
|
||||
obj.push_back(Pair("hex", HexStr(subscript.begin(), subscript.end())));
|
||||
obj.pushKV("script", GetTxnOutputType(whichType));
|
||||
obj.pushKV("hex", HexStr(subscript.begin(), subscript.end()));
|
||||
UniValue a(UniValue::VARR);
|
||||
BOOST_FOREACH(const CTxDestination& addr, addresses)
|
||||
a.push_back(CBitcoinAddress(addr).ToString());
|
||||
obj.push_back(Pair("addresses", a));
|
||||
obj.pushKV("addresses", a);
|
||||
if (whichType == TX_MULTISIG)
|
||||
obj.push_back(Pair("sigsrequired", nRequired));
|
||||
obj.pushKV("sigsrequired", nRequired);
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
@ -186,24 +186,24 @@ UniValue validateaddress(const JSONRPCRequest& request)
|
|||
bool isValid = address.IsValid();
|
||||
|
||||
UniValue ret(UniValue::VOBJ);
|
||||
ret.push_back(Pair("isvalid", isValid));
|
||||
ret.pushKV("isvalid", isValid);
|
||||
if (isValid)
|
||||
{
|
||||
CTxDestination dest = address.Get();
|
||||
string currentAddress = address.ToString();
|
||||
ret.push_back(Pair("address", currentAddress));
|
||||
ret.pushKV("address", currentAddress);
|
||||
|
||||
CScript scriptPubKey = GetScriptForDestination(dest);
|
||||
ret.push_back(Pair("scriptPubKey", HexStr(scriptPubKey.begin(), scriptPubKey.end())));
|
||||
ret.pushKV("scriptPubKey", HexStr(scriptPubKey.begin(), scriptPubKey.end()));
|
||||
|
||||
#ifdef ENABLE_WALLET
|
||||
isminetype mine = pwalletMain ? IsMine(*pwalletMain, dest) : ISMINE_NO;
|
||||
ret.push_back(Pair("ismine", (mine & ISMINE_SPENDABLE) ? true : false));
|
||||
ret.push_back(Pair("iswatchonly", (mine & ISMINE_WATCH_ONLY) ? true: false));
|
||||
ret.pushKV("ismine", (mine & ISMINE_SPENDABLE) ? true : false);
|
||||
ret.pushKV("iswatchonly", (mine & ISMINE_WATCH_ONLY) ? true: false);
|
||||
UniValue detail = boost::apply_visitor(DescribeAddressVisitor(), dest);
|
||||
ret.pushKVs(detail);
|
||||
if (pwalletMain && pwalletMain->mapAddressBook.count(dest))
|
||||
ret.push_back(Pair("account", pwalletMain->mapAddressBook[dest].name));
|
||||
ret.pushKV("account", pwalletMain->mapAddressBook[dest].name);
|
||||
CKeyID keyID;
|
||||
if (pwalletMain) {
|
||||
const auto& meta = pwalletMain->mapKeyMetadata;
|
||||
|
@ -212,10 +212,10 @@ UniValue validateaddress(const JSONRPCRequest& request)
|
|||
it = meta.find(CScriptID(scriptPubKey));
|
||||
}
|
||||
if (it != meta.end()) {
|
||||
ret.push_back(Pair("timestamp", it->second.nCreateTime));
|
||||
ret.pushKV("timestamp", it->second.nCreateTime);
|
||||
if (!it->second.hdKeypath.empty()) {
|
||||
ret.push_back(Pair("hdkeypath", it->second.hdKeypath));
|
||||
ret.push_back(Pair("hdmasterkeyid", it->second.hdMasterKeyID.GetHex()));
|
||||
ret.pushKV("hdkeypath", it->second.hdKeypath);
|
||||
ret.pushKV("hdmasterkeyid", it->second.hdMasterKeyID.GetHex());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -325,8 +325,8 @@ UniValue createmultisig(const JSONRPCRequest& request)
|
|||
CBitcoinAddress address(innerID);
|
||||
|
||||
UniValue result(UniValue::VOBJ);
|
||||
result.push_back(Pair("address", address.ToString()));
|
||||
result.push_back(Pair("redeemScript", HexStr(inner.begin(), inner.end())));
|
||||
result.pushKV("address", address.ToString());
|
||||
result.pushKV("redeemScript", HexStr(inner.begin(), inner.end()));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -458,12 +458,12 @@ static UniValue RPCLockedMemoryInfo()
|
|||
{
|
||||
LockedPool::Stats stats = LockedPoolManager::Instance().stats();
|
||||
UniValue obj(UniValue::VOBJ);
|
||||
obj.push_back(Pair("used", uint64_t(stats.used)));
|
||||
obj.push_back(Pair("free", uint64_t(stats.free)));
|
||||
obj.push_back(Pair("total", uint64_t(stats.total)));
|
||||
obj.push_back(Pair("locked", uint64_t(stats.locked)));
|
||||
obj.push_back(Pair("chunks_used", uint64_t(stats.chunks_used)));
|
||||
obj.push_back(Pair("chunks_free", uint64_t(stats.chunks_free)));
|
||||
obj.pushKV("used", uint64_t(stats.used));
|
||||
obj.pushKV("free", uint64_t(stats.free));
|
||||
obj.pushKV("total", uint64_t(stats.total));
|
||||
obj.pushKV("locked", uint64_t(stats.locked));
|
||||
obj.pushKV("chunks_used", uint64_t(stats.chunks_used));
|
||||
obj.pushKV("chunks_free", uint64_t(stats.chunks_free));
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
@ -492,7 +492,7 @@ UniValue getmemoryinfo(const JSONRPCRequest& request)
|
|||
+ HelpExampleRpc("getmemoryinfo", "")
|
||||
);
|
||||
UniValue obj(UniValue::VOBJ);
|
||||
obj.push_back(Pair("locked", RPCLockedMemoryInfo()));
|
||||
obj.pushKV("locked", RPCLockedMemoryInfo());
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
|
138
src/rpc/net.cpp
138
src/rpc/net.cpp
|
@ -133,58 +133,58 @@ UniValue getpeerinfo(const JSONRPCRequest& request)
|
|||
UniValue obj(UniValue::VOBJ);
|
||||
CNodeStateStats statestats;
|
||||
bool fStateStats = GetNodeStateStats(stats.nodeid, statestats);
|
||||
obj.push_back(Pair("id", stats.nodeid));
|
||||
obj.push_back(Pair("addr", stats.addrName));
|
||||
obj.pushKV("id", stats.nodeid);
|
||||
obj.pushKV("addr", stats.addrName);
|
||||
if (!(stats.addrLocal.empty()))
|
||||
obj.push_back(Pair("addrlocal", stats.addrLocal));
|
||||
obj.push_back(Pair("services", strprintf("%016x", stats.nServices)));
|
||||
obj.push_back(Pair("relaytxes", stats.fRelayTxes));
|
||||
obj.push_back(Pair("lastsend", stats.nLastSend));
|
||||
obj.push_back(Pair("lastrecv", stats.nLastRecv));
|
||||
obj.push_back(Pair("bytessent", stats.nSendBytes));
|
||||
obj.push_back(Pair("bytesrecv", stats.nRecvBytes));
|
||||
obj.push_back(Pair("conntime", stats.nTimeConnected));
|
||||
obj.push_back(Pair("timeoffset", stats.nTimeOffset));
|
||||
obj.pushKV("addrlocal", stats.addrLocal);
|
||||
obj.pushKV("services", strprintf("%016x", stats.nServices));
|
||||
obj.pushKV("relaytxes", stats.fRelayTxes);
|
||||
obj.pushKV("lastsend", stats.nLastSend);
|
||||
obj.pushKV("lastrecv", stats.nLastRecv);
|
||||
obj.pushKV("bytessent", stats.nSendBytes);
|
||||
obj.pushKV("bytesrecv", stats.nRecvBytes);
|
||||
obj.pushKV("conntime", stats.nTimeConnected);
|
||||
obj.pushKV("timeoffset", stats.nTimeOffset);
|
||||
if (stats.dPingTime > 0.0)
|
||||
obj.push_back(Pair("pingtime", stats.dPingTime));
|
||||
obj.pushKV("pingtime", stats.dPingTime);
|
||||
if (stats.dMinPing < std::numeric_limits<int64_t>::max()/1e6)
|
||||
obj.push_back(Pair("minping", stats.dMinPing));
|
||||
obj.pushKV("minping", stats.dMinPing);
|
||||
if (stats.dPingWait > 0.0)
|
||||
obj.push_back(Pair("pingwait", stats.dPingWait));
|
||||
obj.push_back(Pair("version", stats.nVersion));
|
||||
obj.pushKV("pingwait", stats.dPingWait);
|
||||
obj.pushKV("version", stats.nVersion);
|
||||
// Use the sanitized form of subver here, to avoid tricksy remote peers from
|
||||
// corrupting or modifying the JSON output by putting special characters in
|
||||
// their ver message.
|
||||
obj.push_back(Pair("subver", stats.cleanSubVer));
|
||||
obj.push_back(Pair("inbound", stats.fInbound));
|
||||
obj.push_back(Pair("addnode", stats.fAddnode));
|
||||
obj.push_back(Pair("startingheight", stats.nStartingHeight));
|
||||
obj.push_back(Pair("feefilter", FormatMoney(stats.minFeeFilter)));
|
||||
obj.pushKV("subver", stats.cleanSubVer);
|
||||
obj.pushKV("inbound", stats.fInbound);
|
||||
obj.pushKV("addnode", stats.fAddnode);
|
||||
obj.pushKV("startingheight", stats.nStartingHeight);
|
||||
obj.pushKV("feefilter", FormatMoney(stats.minFeeFilter));
|
||||
if (fStateStats) {
|
||||
obj.push_back(Pair("banscore", statestats.nMisbehavior));
|
||||
obj.push_back(Pair("synced_headers", statestats.nSyncHeight));
|
||||
obj.push_back(Pair("synced_blocks", statestats.nCommonHeight));
|
||||
obj.pushKV("banscore", statestats.nMisbehavior);
|
||||
obj.pushKV("synced_headers", statestats.nSyncHeight);
|
||||
obj.pushKV("synced_blocks", statestats.nCommonHeight);
|
||||
UniValue heights(UniValue::VARR);
|
||||
BOOST_FOREACH(int height, statestats.vHeightInFlight) {
|
||||
heights.push_back(height);
|
||||
}
|
||||
obj.push_back(Pair("inflight", heights));
|
||||
obj.pushKV("inflight", heights);
|
||||
}
|
||||
obj.push_back(Pair("whitelisted", stats.fWhitelisted));
|
||||
obj.pushKV("whitelisted", stats.fWhitelisted);
|
||||
|
||||
UniValue sendPerMsgCmd(UniValue::VOBJ);
|
||||
BOOST_FOREACH(const mapMsgCmdSize::value_type &i, stats.mapSendBytesPerMsgCmd) {
|
||||
if (i.second > 0)
|
||||
sendPerMsgCmd.push_back(Pair(i.first, i.second));
|
||||
sendPerMsgCmd.pushKV(i.first, i.second);
|
||||
}
|
||||
obj.push_back(Pair("bytessent_per_msg", sendPerMsgCmd));
|
||||
obj.pushKV("bytessent_per_msg", sendPerMsgCmd);
|
||||
|
||||
UniValue recvPerMsgCmd(UniValue::VOBJ);
|
||||
BOOST_FOREACH(const mapMsgCmdSize::value_type &i, stats.mapRecvBytesPerMsgCmd) {
|
||||
if (i.second > 0)
|
||||
recvPerMsgCmd.push_back(Pair(i.first, i.second));
|
||||
recvPerMsgCmd.pushKV(i.first, i.second);
|
||||
}
|
||||
obj.push_back(Pair("bytesrecv_per_msg", recvPerMsgCmd));
|
||||
obj.pushKV("bytesrecv_per_msg", recvPerMsgCmd);
|
||||
|
||||
ret.push_back(obj);
|
||||
}
|
||||
|
@ -312,16 +312,16 @@ UniValue getaddednodeinfo(const JSONRPCRequest& request)
|
|||
|
||||
for (const AddedNodeInfo& info : vInfo) {
|
||||
UniValue obj(UniValue::VOBJ);
|
||||
obj.push_back(Pair("addednode", info.strAddedNode));
|
||||
obj.push_back(Pair("connected", info.fConnected));
|
||||
obj.pushKV("addednode", info.strAddedNode);
|
||||
obj.pushKV("connected", info.fConnected);
|
||||
UniValue addresses(UniValue::VARR);
|
||||
if (info.fConnected) {
|
||||
UniValue address(UniValue::VOBJ);
|
||||
address.push_back(Pair("address", info.resolvedAddress.ToString()));
|
||||
address.push_back(Pair("connected", info.fInbound ? "inbound" : "outbound"));
|
||||
address.pushKV("address", info.resolvedAddress.ToString());
|
||||
address.pushKV("connected", info.fInbound ? "inbound" : "outbound");
|
||||
addresses.push_back(address);
|
||||
}
|
||||
obj.push_back(Pair("addresses", addresses));
|
||||
obj.pushKV("addresses", addresses);
|
||||
ret.push_back(obj);
|
||||
}
|
||||
|
||||
|
@ -358,18 +358,18 @@ UniValue getnettotals(const JSONRPCRequest& request)
|
|||
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
|
||||
|
||||
UniValue obj(UniValue::VOBJ);
|
||||
obj.push_back(Pair("totalbytesrecv", g_connman->GetTotalBytesRecv()));
|
||||
obj.push_back(Pair("totalbytessent", g_connman->GetTotalBytesSent()));
|
||||
obj.push_back(Pair("timemillis", GetTimeMillis()));
|
||||
obj.pushKV("totalbytesrecv", g_connman->GetTotalBytesRecv());
|
||||
obj.pushKV("totalbytessent", g_connman->GetTotalBytesSent());
|
||||
obj.pushKV("timemillis", GetTimeMillis());
|
||||
|
||||
UniValue outboundLimit(UniValue::VOBJ);
|
||||
outboundLimit.push_back(Pair("timeframe", g_connman->GetMaxOutboundTimeframe()));
|
||||
outboundLimit.push_back(Pair("target", g_connman->GetMaxOutboundTarget()));
|
||||
outboundLimit.push_back(Pair("target_reached", g_connman->OutboundTargetReached(false)));
|
||||
outboundLimit.push_back(Pair("serve_historical_blocks", !g_connman->OutboundTargetReached(true)));
|
||||
outboundLimit.push_back(Pair("bytes_left_in_cycle", g_connman->GetOutboundTargetBytesLeft()));
|
||||
outboundLimit.push_back(Pair("time_left_in_cycle", g_connman->GetMaxOutboundTimeLeftInCycle()));
|
||||
obj.push_back(Pair("uploadtarget", outboundLimit));
|
||||
outboundLimit.pushKV("timeframe", g_connman->GetMaxOutboundTimeframe());
|
||||
outboundLimit.pushKV("target", g_connman->GetMaxOutboundTarget());
|
||||
outboundLimit.pushKV("target_reached", g_connman->OutboundTargetReached(false));
|
||||
outboundLimit.pushKV("serve_historical_blocks", !g_connman->OutboundTargetReached(true));
|
||||
outboundLimit.pushKV("bytes_left_in_cycle", g_connman->GetOutboundTargetBytesLeft());
|
||||
outboundLimit.pushKV("time_left_in_cycle", g_connman->GetMaxOutboundTimeLeftInCycle());
|
||||
obj.pushKV("uploadtarget", outboundLimit);
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
@ -384,11 +384,11 @@ static UniValue GetNetworksInfo()
|
|||
proxyType proxy;
|
||||
UniValue obj(UniValue::VOBJ);
|
||||
GetProxy(network, proxy);
|
||||
obj.push_back(Pair("name", GetNetworkName(network)));
|
||||
obj.push_back(Pair("limited", IsLimited(network)));
|
||||
obj.push_back(Pair("reachable", IsReachable(network)));
|
||||
obj.push_back(Pair("proxy", proxy.IsValid() ? proxy.proxy.ToStringIPPort() : string()));
|
||||
obj.push_back(Pair("proxy_randomize_credentials", proxy.randomize_credentials));
|
||||
obj.pushKV("name", GetNetworkName(network));
|
||||
obj.pushKV("limited", IsLimited(network));
|
||||
obj.pushKV("reachable", IsReachable(network));
|
||||
obj.pushKV("proxy", proxy.IsValid() ? proxy.proxy.ToStringIPPort() : string());
|
||||
obj.pushKV("proxy_randomize_credentials", proxy.randomize_credentials);
|
||||
networks.push_back(obj);
|
||||
}
|
||||
return networks;
|
||||
|
@ -439,34 +439,34 @@ UniValue getnetworkinfo(const JSONRPCRequest& request)
|
|||
|
||||
LOCK(cs_main);
|
||||
UniValue obj(UniValue::VOBJ);
|
||||
obj.push_back(Pair("version", CLIENT_VERSION));
|
||||
obj.push_back(Pair("subversion", strSubVersion));
|
||||
obj.push_back(Pair("protocolversion",PROTOCOL_VERSION));
|
||||
obj.pushKV("version", CLIENT_VERSION);
|
||||
obj.pushKV("subversion", strSubVersion);
|
||||
obj.pushKV("protocolversion",PROTOCOL_VERSION);
|
||||
if(g_connman)
|
||||
obj.push_back(Pair("localservices", strprintf("%016x", g_connman->GetLocalServices())));
|
||||
obj.push_back(Pair("localrelay", fRelayTxes));
|
||||
obj.push_back(Pair("timeoffset", GetTimeOffset()));
|
||||
obj.pushKV("localservices", strprintf("%016x", g_connman->GetLocalServices()));
|
||||
obj.pushKV("localrelay", fRelayTxes);
|
||||
obj.pushKV("timeoffset", GetTimeOffset());
|
||||
if (g_connman) {
|
||||
obj.push_back(Pair("networkactive", g_connman->GetNetworkActive()));
|
||||
obj.push_back(Pair("connections", (int)g_connman->GetNodeCount(CConnman::CONNECTIONS_ALL)));
|
||||
obj.pushKV("networkactive", g_connman->GetNetworkActive());
|
||||
obj.pushKV("connections", (int)g_connman->GetNodeCount(CConnman::CONNECTIONS_ALL));
|
||||
}
|
||||
obj.push_back(Pair("networks", GetNetworksInfo()));
|
||||
obj.push_back(Pair("relayfee", ValueFromAmount(::minRelayTxFeeRate.GetFeePerK())));
|
||||
obj.push_back(Pair("incrementalfee", ValueFromAmount(::incrementalRelayFee.GetFeePerK())));
|
||||
obj.pushKV("networks", GetNetworksInfo());
|
||||
obj.pushKV("relayfee", ValueFromAmount(::minRelayTxFeeRate.GetFeePerK()));
|
||||
obj.pushKV("incrementalfee", ValueFromAmount(::incrementalRelayFee.GetFeePerK()));
|
||||
UniValue localAddresses(UniValue::VARR);
|
||||
{
|
||||
LOCK(cs_mapLocalHost);
|
||||
BOOST_FOREACH(const PAIRTYPE(CNetAddr, LocalServiceInfo) &item, mapLocalHost)
|
||||
{
|
||||
UniValue rec(UniValue::VOBJ);
|
||||
rec.push_back(Pair("address", item.first.ToString()));
|
||||
rec.push_back(Pair("port", item.second.nPort));
|
||||
rec.push_back(Pair("score", item.second.nScore));
|
||||
rec.pushKV("address", item.first.ToString());
|
||||
rec.pushKV("port", item.second.nPort);
|
||||
rec.pushKV("score", item.second.nScore);
|
||||
localAddresses.push_back(rec);
|
||||
}
|
||||
}
|
||||
obj.push_back(Pair("localaddresses", localAddresses));
|
||||
obj.push_back(Pair("warnings", GetWarnings("statusbar")));
|
||||
obj.pushKV("localaddresses", localAddresses);
|
||||
obj.pushKV("warnings", GetWarnings("statusbar"));
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
@ -556,10 +556,10 @@ UniValue listbanned(const JSONRPCRequest& request)
|
|||
{
|
||||
CBanEntry banEntry = (*it).second;
|
||||
UniValue rec(UniValue::VOBJ);
|
||||
rec.push_back(Pair("address", (*it).first.ToString()));
|
||||
rec.push_back(Pair("banned_until", banEntry.nBanUntil));
|
||||
rec.push_back(Pair("ban_created", banEntry.nCreateTime));
|
||||
rec.push_back(Pair("ban_reason", banEntry.banReasonToString()));
|
||||
rec.pushKV("address", (*it).first.ToString());
|
||||
rec.pushKV("banned_until", banEntry.nBanUntil);
|
||||
rec.pushKV("ban_created", banEntry.nCreateTime);
|
||||
rec.pushKV("ban_reason", banEntry.banReasonToString());
|
||||
|
||||
bannedAddresses.push_back(rec);
|
||||
}
|
||||
|
|
|
@ -29,9 +29,9 @@ using namespace std;
|
|||
UniValue JSONRPCRequestObj(const string& strMethod, const UniValue& params, const UniValue& id)
|
||||
{
|
||||
UniValue request(UniValue::VOBJ);
|
||||
request.push_back(Pair("method", strMethod));
|
||||
request.push_back(Pair("params", params));
|
||||
request.push_back(Pair("id", id));
|
||||
request.pushKV("method", strMethod);
|
||||
request.pushKV("params", params);
|
||||
request.pushKV("id", id);
|
||||
return request;
|
||||
}
|
||||
|
||||
|
@ -39,11 +39,11 @@ UniValue JSONRPCReplyObj(const UniValue& result, const UniValue& error, const Un
|
|||
{
|
||||
UniValue reply(UniValue::VOBJ);
|
||||
if (!error.isNull())
|
||||
reply.push_back(Pair("result", NullUniValue));
|
||||
reply.pushKV("result", NullUniValue);
|
||||
else
|
||||
reply.push_back(Pair("result", result));
|
||||
reply.push_back(Pair("error", error));
|
||||
reply.push_back(Pair("id", id));
|
||||
reply.pushKV("result", result);
|
||||
reply.pushKV("error", error);
|
||||
reply.pushKV("id", id);
|
||||
return reply;
|
||||
}
|
||||
|
||||
|
@ -56,8 +56,8 @@ string JSONRPCReply(const UniValue& result, const UniValue& error, const UniValu
|
|||
UniValue JSONRPCError(int code, const string& message)
|
||||
{
|
||||
UniValue error(UniValue::VOBJ);
|
||||
error.push_back(Pair("code", code));
|
||||
error.push_back(Pair("message", message));
|
||||
error.pushKV("code", code);
|
||||
error.pushKV("message", message);
|
||||
return error;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,46 +41,46 @@ void ScriptPubKeyToJSON(const CScript& scriptPubKey, UniValue& out, bool fInclud
|
|||
vector<CTxDestination> addresses;
|
||||
int nRequired;
|
||||
|
||||
out.push_back(Pair("asm", ScriptToAsmStr(scriptPubKey)));
|
||||
out.pushKV("asm", ScriptToAsmStr(scriptPubKey));
|
||||
if (fIncludeHex)
|
||||
out.push_back(Pair("hex", HexStr(scriptPubKey.begin(), scriptPubKey.end())));
|
||||
out.pushKV("hex", HexStr(scriptPubKey.begin(), scriptPubKey.end()));
|
||||
|
||||
if (!ExtractDestinations(scriptPubKey, type, addresses, nRequired)) {
|
||||
out.push_back(Pair("type", GetTxnOutputType(type)));
|
||||
out.pushKV("type", GetTxnOutputType(type));
|
||||
return;
|
||||
}
|
||||
|
||||
out.push_back(Pair("reqSigs", nRequired));
|
||||
out.push_back(Pair("type", GetTxnOutputType(type)));
|
||||
out.pushKV("reqSigs", nRequired);
|
||||
out.pushKV("type", GetTxnOutputType(type));
|
||||
|
||||
UniValue a(UniValue::VARR);
|
||||
BOOST_FOREACH(const CTxDestination& addr, addresses)
|
||||
a.push_back(CBitcoinAddress(addr).ToString());
|
||||
out.push_back(Pair("addresses", a));
|
||||
out.pushKV("addresses", a);
|
||||
}
|
||||
|
||||
void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry)
|
||||
{
|
||||
entry.push_back(Pair("txid", tx.GetHash().GetHex()));
|
||||
entry.push_back(Pair("hash", tx.GetWitnessHash().GetHex()));
|
||||
entry.push_back(Pair("size", (int)::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION)));
|
||||
entry.push_back(Pair("vsize", (int)::GetVirtualTransactionSize(tx)));
|
||||
entry.push_back(Pair("version", tx.nVersion));
|
||||
entry.push_back(Pair("locktime", (int64_t)tx.nLockTime));
|
||||
entry.pushKV("txid", tx.GetHash().GetHex());
|
||||
entry.pushKV("hash", tx.GetWitnessHash().GetHex());
|
||||
entry.pushKV("size", (int)::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION));
|
||||
entry.pushKV("vsize", (int)::GetVirtualTransactionSize(tx));
|
||||
entry.pushKV("version", tx.nVersion);
|
||||
entry.pushKV("locktime", (int64_t)tx.nLockTime);
|
||||
|
||||
UniValue vin(UniValue::VARR);
|
||||
for (unsigned int i = 0; i < tx.vin.size(); i++) {
|
||||
const CTxIn& txin = tx.vin[i];
|
||||
UniValue in(UniValue::VOBJ);
|
||||
if (tx.IsCoinBase())
|
||||
in.push_back(Pair("coinbase", HexStr(txin.scriptSig.begin(), txin.scriptSig.end())));
|
||||
in.pushKV("coinbase", HexStr(txin.scriptSig.begin(), txin.scriptSig.end()));
|
||||
else {
|
||||
in.push_back(Pair("txid", txin.prevout.hash.GetHex()));
|
||||
in.push_back(Pair("vout", (int64_t)txin.prevout.n));
|
||||
in.pushKV("txid", txin.prevout.hash.GetHex());
|
||||
in.pushKV("vout", (int64_t)txin.prevout.n);
|
||||
UniValue o(UniValue::VOBJ);
|
||||
o.push_back(Pair("asm", ScriptToAsmStr(txin.scriptSig, true)));
|
||||
o.push_back(Pair("hex", HexStr(txin.scriptSig.begin(), txin.scriptSig.end())));
|
||||
in.push_back(Pair("scriptSig", o));
|
||||
o.pushKV("asm", ScriptToAsmStr(txin.scriptSig, true));
|
||||
o.pushKV("hex", HexStr(txin.scriptSig.begin(), txin.scriptSig.end()));
|
||||
in.pushKV("scriptSig", o);
|
||||
}
|
||||
if (tx.HasWitness()) {
|
||||
UniValue txinwitness(UniValue::VARR);
|
||||
|
@ -88,37 +88,37 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry)
|
|||
std::vector<unsigned char> item = tx.vin[i].scriptWitness.stack[j];
|
||||
txinwitness.push_back(HexStr(item.begin(), item.end()));
|
||||
}
|
||||
in.push_back(Pair("txinwitness", txinwitness));
|
||||
in.pushKV("txinwitness", txinwitness);
|
||||
}
|
||||
in.push_back(Pair("sequence", (int64_t)txin.nSequence));
|
||||
in.pushKV("sequence", (int64_t)txin.nSequence);
|
||||
vin.push_back(in);
|
||||
}
|
||||
entry.push_back(Pair("vin", vin));
|
||||
entry.pushKV("vin", vin);
|
||||
UniValue vout(UniValue::VARR);
|
||||
for (unsigned int i = 0; i < tx.vout.size(); i++) {
|
||||
const CTxOut& txout = tx.vout[i];
|
||||
UniValue out(UniValue::VOBJ);
|
||||
out.push_back(Pair("value", ValueFromAmount(txout.nValue)));
|
||||
out.push_back(Pair("n", (int64_t)i));
|
||||
out.pushKV("value", ValueFromAmount(txout.nValue));
|
||||
out.pushKV("n", (int64_t)i);
|
||||
UniValue o(UniValue::VOBJ);
|
||||
ScriptPubKeyToJSON(txout.scriptPubKey, o, true);
|
||||
out.push_back(Pair("scriptPubKey", o));
|
||||
out.pushKV("scriptPubKey", o);
|
||||
vout.push_back(out);
|
||||
}
|
||||
entry.push_back(Pair("vout", vout));
|
||||
entry.pushKV("vout", vout);
|
||||
|
||||
if (!hashBlock.IsNull()) {
|
||||
entry.push_back(Pair("blockhash", hashBlock.GetHex()));
|
||||
entry.pushKV("blockhash", hashBlock.GetHex());
|
||||
BlockMap::iterator mi = mapBlockIndex.find(hashBlock);
|
||||
if (mi != mapBlockIndex.end() && (*mi).second) {
|
||||
CBlockIndex* pindex = (*mi).second;
|
||||
if (chainActive.Contains(pindex)) {
|
||||
entry.push_back(Pair("confirmations", 1 + chainActive.Height() - pindex->nHeight));
|
||||
entry.push_back(Pair("time", pindex->GetBlockTime()));
|
||||
entry.push_back(Pair("blocktime", pindex->GetBlockTime()));
|
||||
entry.pushKV("confirmations", 1 + chainActive.Height() - pindex->nHeight);
|
||||
entry.pushKV("time", pindex->GetBlockTime());
|
||||
entry.pushKV("blocktime", pindex->GetBlockTime());
|
||||
}
|
||||
else
|
||||
entry.push_back(Pair("confirmations", 0));
|
||||
entry.pushKV("confirmations", 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ UniValue getrawtransaction(const JSONRPCRequest& request)
|
|||
return strHex;
|
||||
|
||||
UniValue result(UniValue::VOBJ);
|
||||
result.push_back(Pair("hex", strHex));
|
||||
result.pushKV("hex", strHex);
|
||||
TxToJSON(*tx, hashBlock, result);
|
||||
return result;
|
||||
}
|
||||
|
@ -575,7 +575,7 @@ UniValue decodescript(const JSONRPCRequest& request)
|
|||
if (type.isStr() && type.get_str() != "scripthash") {
|
||||
// P2SH cannot be wrapped in a P2SH. If this script is already a P2SH,
|
||||
// don't return the address for a P2SH of the P2SH.
|
||||
r.push_back(Pair("p2sh", CBitcoinAddress(CScriptID(script)).ToString()));
|
||||
r.pushKV("p2sh", CBitcoinAddress(CScriptID(script)).ToString());
|
||||
}
|
||||
|
||||
return r;
|
||||
|
@ -585,11 +585,11 @@ UniValue decodescript(const JSONRPCRequest& request)
|
|||
static void TxInErrorToJSON(const CTxIn& txin, UniValue& vErrorsRet, const std::string& strMessage)
|
||||
{
|
||||
UniValue entry(UniValue::VOBJ);
|
||||
entry.push_back(Pair("txid", txin.prevout.hash.ToString()));
|
||||
entry.push_back(Pair("vout", (uint64_t)txin.prevout.n));
|
||||
entry.push_back(Pair("scriptSig", HexStr(txin.scriptSig.begin(), txin.scriptSig.end())));
|
||||
entry.push_back(Pair("sequence", (uint64_t)txin.nSequence));
|
||||
entry.push_back(Pair("error", strMessage));
|
||||
entry.pushKV("txid", txin.prevout.hash.ToString());
|
||||
entry.pushKV("vout", (uint64_t)txin.prevout.n);
|
||||
entry.pushKV("scriptSig", HexStr(txin.scriptSig.begin(), txin.scriptSig.end()));
|
||||
entry.pushKV("sequence", (uint64_t)txin.nSequence);
|
||||
entry.pushKV("error", strMessage);
|
||||
vErrorsRet.push_back(entry);
|
||||
}
|
||||
|
||||
|
@ -850,10 +850,10 @@ UniValue signrawtransaction(const JSONRPCRequest& request)
|
|||
bool fComplete = vErrors.empty();
|
||||
|
||||
UniValue result(UniValue::VOBJ);
|
||||
result.push_back(Pair("hex", EncodeHexTx(mergedTx)));
|
||||
result.push_back(Pair("complete", fComplete));
|
||||
result.pushKV("hex", EncodeHexTx(mergedTx));
|
||||
result.pushKV("complete", fComplete);
|
||||
if (!vErrors.empty()) {
|
||||
result.push_back(Pair("errors", vErrors));
|
||||
result.pushKV("errors", vErrors);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
@ -1,151 +1,151 @@
|
|||
[
|
||||
[
|
||||
""
|
||||
],
|
||||
],
|
||||
[
|
||||
"x"
|
||||
],
|
||||
],
|
||||
[
|
||||
"37qgekLpCCHrQuSjvX3fs496FWTGsHFHizjJAs6NPcR47aefnnCWECAhHV6E3g4YN7u7Yuwod5Y"
|
||||
],
|
||||
],
|
||||
[
|
||||
"dzb7VV1Ui55BARxv7ATxAtCUeJsANKovDGWFVgpTbhq9gvPqP3yv"
|
||||
],
|
||||
],
|
||||
[
|
||||
"MuNu7ZAEDFiHthiunm7dPjwKqrVNCM3mAz6rP9zFveQu14YA8CxExSJTHcVP9DErn6u84E6Ej7S"
|
||||
],
|
||||
],
|
||||
[
|
||||
"rPpQpYknyNQ5AEHuY6H8ijJJrYc2nDKKk9jjmKEXsWzyAQcFGpDLU2Zvsmoi8JLR7hAwoy3RQWf"
|
||||
],
|
||||
],
|
||||
[
|
||||
"4Uc3FmN6NQ6zLBK5QQBXRBUREaaHwCZYsGCueHauuDmJpZKn6jkEskMB2Zi2CNgtb5r6epWEFfUJq"
|
||||
],
|
||||
],
|
||||
[
|
||||
"7aQgR5DFQ25vyXmqZAWmnVCjL3PkBcdVkBUpjrjMTcghHx3E8wb"
|
||||
],
|
||||
],
|
||||
[
|
||||
"17QpPprjeg69fW1DV8DcYYCKvWjYhXvWkov6MJ1iTTvMFj6weAqW7wybZeH57WTNxXVCRH4veVs"
|
||||
],
|
||||
],
|
||||
[
|
||||
"KxuACDviz8Xvpn1xAh9MfopySZNuyajYMZWz16Dv2mHHryznWUp3"
|
||||
],
|
||||
],
|
||||
[
|
||||
"7nK3GSmqdXJQtdohvGfJ7KsSmn3TmGqExug49583bDAL91pVSGq5xS9SHoAYL3Wv3ijKTit65th"
|
||||
],
|
||||
],
|
||||
[
|
||||
"cTivdBmq7bay3RFGEBBuNfMh2P1pDCgRYN2Wbxmgwr4ki3jNUL2va"
|
||||
],
|
||||
],
|
||||
[
|
||||
"gjMV4vjNjyMrna4fsAr8bWxAbwtmMUBXJS3zL4NJt5qjozpbQLmAfK1uA3CquSqsZQMpoD1g2nk"
|
||||
],
|
||||
],
|
||||
[
|
||||
"emXm1naBMoVzPjbk7xpeTVMFy4oDEe25UmoyGgKEB1gGWsK8kRGs"
|
||||
],
|
||||
],
|
||||
[
|
||||
"7VThQnNRj1o3Zyvc7XHPRrjDf8j2oivPTeDXnRPYWeYGE4pXeRJDZgf28ppti5hsHWXS2GSobdqyo"
|
||||
],
|
||||
],
|
||||
[
|
||||
"1G9u6oCVCPh2o8m3t55ACiYvG1y5BHewUkDSdiQarDcYXXhFHYdzMdYfUAhfxn5vNZBwpgUNpso"
|
||||
],
|
||||
],
|
||||
[
|
||||
"31QQ7ZMLkScDiB4VyZjuptr7AEc9j1SjstF7pRoLhHTGkW4Q2y9XELobQmhhWxeRvqcukGd1XCq"
|
||||
],
|
||||
],
|
||||
[
|
||||
"DHqKSnpxa8ZdQyH8keAhvLTrfkyBMQxqngcQA5N8LQ9KVt25kmGN"
|
||||
],
|
||||
],
|
||||
[
|
||||
"2LUHcJPbwLCy9GLH1qXmfmAwvadWw4bp4PCpDfduLqV17s6iDcy1imUwhQJhAoNoN1XNmweiJP4i"
|
||||
],
|
||||
],
|
||||
[
|
||||
"7USRzBXAnmck8fX9HmW7RAb4qt92VFX6soCnts9s74wxm4gguVhtG5of8fZGbNPJA83irHVY6bCos"
|
||||
],
|
||||
],
|
||||
[
|
||||
"1DGezo7BfVebZxAbNT3XGujdeHyNNBF3vnficYoTSp4PfK2QaML9bHzAMxke3wdKdHYWmsMTJVu"
|
||||
],
|
||||
],
|
||||
[
|
||||
"2D12DqDZKwCxxkzs1ZATJWvgJGhQ4cFi3WrizQ5zLAyhN5HxuAJ1yMYaJp8GuYsTLLxTAz6otCfb"
|
||||
],
|
||||
],
|
||||
[
|
||||
"8AFJzuTujXjw1Z6M3fWhQ1ujDW7zsV4ePeVjVo7D1egERqSW9nZ"
|
||||
],
|
||||
],
|
||||
[
|
||||
"163Q17qLbTCue8YY3AvjpUhotuaodLm2uqMhpYirsKjVqnxJRWTEoywMVY3NbBAHuhAJ2cF9GAZ"
|
||||
],
|
||||
],
|
||||
[
|
||||
"2MnmgiRH4eGLyLc9eAqStzk7dFgBjFtUCtu"
|
||||
],
|
||||
],
|
||||
[
|
||||
"461QQ2sYWxU7H2PV4oBwJGNch8XVTYYbZxU"
|
||||
],
|
||||
],
|
||||
[
|
||||
"2UCtv53VttmQYkVU4VMtXB31REvQg4ABzs41AEKZ8UcB7DAfVzdkV9JDErwGwyj5AUHLkmgZeobs"
|
||||
],
|
||||
],
|
||||
[
|
||||
"cSNjAsnhgtiFMi6MtfvgscMB2Cbhn2v1FUYfviJ1CdjfidvmeW6mn"
|
||||
],
|
||||
],
|
||||
[
|
||||
"gmsow2Y6EWAFDFE1CE4Hd3Tpu2BvfmBfG1SXsuRARbnt1WjkZnFh1qGTiptWWbjsq2Q6qvpgJVj"
|
||||
],
|
||||
],
|
||||
[
|
||||
"nksUKSkzS76v8EsSgozXGMoQFiCoCHzCVajFKAXqzK5on9ZJYVHMD5CKwgmX3S3c7M1U3xabUny"
|
||||
],
|
||||
],
|
||||
[
|
||||
"L3favK1UzFGgdzYBF2oBT5tbayCo4vtVBLJhg2iYuMeePxWG8SQc"
|
||||
],
|
||||
],
|
||||
[
|
||||
"7VxLxGGtYT6N99GdEfi6xz56xdQ8nP2dG1CavuXx7Rf2PrvNMTBNevjkfgs9JmkcGm6EXpj8ipyPZ"
|
||||
],
|
||||
],
|
||||
[
|
||||
"2mbZwFXF6cxShaCo2czTRB62WTx9LxhTtpP"
|
||||
],
|
||||
],
|
||||
[
|
||||
"dB7cwYdcPSgiyAwKWL3JwCVwSk6epU2txw"
|
||||
],
|
||||
],
|
||||
[
|
||||
"HPhFUhUAh8ZQQisH8QQWafAxtQYju3SFTX"
|
||||
],
|
||||
],
|
||||
[
|
||||
"4ctAH6AkHzq5ioiM1m9T3E2hiYEev5mTsB"
|
||||
],
|
||||
],
|
||||
[
|
||||
"Hn1uFi4dNexWrqARpjMqgT6cX1UsNPuV3cHdGg9ExyXw8HTKadbktRDtdeVmY3M1BxJStiL4vjJ"
|
||||
],
|
||||
],
|
||||
[
|
||||
"Sq3fDbvutABmnAHHExJDgPLQn44KnNC7UsXuT7KZecpaYDMU9Txs"
|
||||
],
|
||||
],
|
||||
[
|
||||
"6TqWyrqdgUEYDQU1aChMuFMMEimHX44qHFzCUgGfqxGgZNMUVWJ"
|
||||
],
|
||||
],
|
||||
[
|
||||
"giqJo7oWqFxNKWyrgcBxAVHXnjJ1t6cGoEffce5Y1y7u649Noj5wJ4mmiUAKEVVrYAGg2KPB3Y4"
|
||||
],
|
||||
],
|
||||
[
|
||||
"cNzHY5e8vcmM3QVJUcjCyiKMYfeYvyueq5qCMV3kqcySoLyGLYUK"
|
||||
],
|
||||
],
|
||||
[
|
||||
"37uTe568EYc9WLoHEd9jXEvUiWbq5LFLscNyqvAzLU5vBArUJA6eydkLmnMwJDjkL5kXc2VK7ig"
|
||||
],
|
||||
],
|
||||
[
|
||||
"EsYbG4tWWWY45G31nox838qNdzksbPySWc"
|
||||
],
|
||||
],
|
||||
[
|
||||
"nbuzhfwMoNzA3PaFnyLcRxE9bTJPDkjZ6Rf6Y6o2ckXZfzZzXBT"
|
||||
],
|
||||
],
|
||||
[
|
||||
"cQN9PoxZeCWK1x56xnz6QYAsvR11XAce3Ehp3gMUdfSQ53Y2mPzx"
|
||||
],
|
||||
],
|
||||
[
|
||||
"1Gm3N3rkef6iMbx4voBzaxtXcmmiMTqZPhcuAepRzYUJQW4qRpEnHvMojzof42hjFRf8PE2jPde"
|
||||
],
|
||||
],
|
||||
[
|
||||
"2TAq2tuN6x6m233bpT7yqdYQPELdTDJn1eU"
|
||||
],
|
||||
],
|
||||
[
|
||||
"ntEtnnGhqPii4joABvBtSEJG6BxjT2tUZqE8PcVYgk3RHpgxgHDCQxNbLJf7ardf1dDk2oCQ7Cf"
|
||||
],
|
||||
],
|
||||
[
|
||||
"Ky1YjoZNgQ196HJV3HpdkecfhRBmRZdMJk89Hi5KGfpfPwS2bUbfd"
|
||||
],
|
||||
],
|
||||
[
|
||||
"2A1q1YsMZowabbvta7kTy2Fd6qN4r5ZCeG3qLpvZBMzCixMUdkN2Y4dHB1wPsZAeVXUGD83MfRED"
|
||||
]
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
"isPrivkey": false,
|
||||
"isTestnet": false
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"A7HRQk3GFCW2QasvdZxXuYj8kkQK5QrYLs",
|
||||
"a2dd71f34fe73314d6e37c44035513f203aa400b",
|
||||
|
@ -30,422 +30,422 @@
|
|||
"2MsvyG12kxxipe276Au4zKqvd2xdrBuHWb3",
|
||||
"078457e357c6c4d8736515d14482089dd2a1f9f8",
|
||||
{
|
||||
"addrType": "script",
|
||||
"isPrivkey": false,
|
||||
"addrType": "script",
|
||||
"isPrivkey": false,
|
||||
"isTestnet": true
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"6K7a8wZW8A1oZxNd7wZz8PhgAAaDxybkzNpD1sGVvmSaBmc3Hg2",
|
||||
"81517fd848ebfeda7e2c684e7a3f5ebbb28b15d52d33d8a201d8873a0cdaf761",
|
||||
"6K7a8wZW8A1oZxNd7wZz8PhgAAaDxybkzNpD1sGVvmSaBmc3Hg2",
|
||||
"81517fd848ebfeda7e2c684e7a3f5ebbb28b15d52d33d8a201d8873a0cdaf761",
|
||||
{
|
||||
"isCompressed": false,
|
||||
"isPrivkey": true,
|
||||
"isCompressed": false,
|
||||
"isPrivkey": true,
|
||||
"isTestnet": false
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"QP5rQxpaP8HHPEdCEqxTjiHGWRvsyPvzZJeJ9BCxpfT13FN9VesQ",
|
||||
"0e017cc6ad98c6646a1139114e8dcd9bf2537f3e0306a2f43dea03f91fea370a0",
|
||||
"QP5rQxpaP8HHPEdCEqxTjiHGWRvsyPvzZJeJ9BCxpfT13FN9VesQ",
|
||||
"0e017cc6ad98c6646a1139114e8dcd9bf2537f3e0306a2f43dea03f91fea370a0",
|
||||
{
|
||||
"isCompressed": true,
|
||||
"isPrivkey": true,
|
||||
"isCompressed": true,
|
||||
"isPrivkey": true,
|
||||
"isTestnet": false
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"96MAePnF8ppQm8165ABvzSEShnNy3vgxjmMhcqEkQVZ9FtPV2XL",
|
||||
"73423bf1fa6526ee571f3b4b4ad19799c81d40ce5c18a37d87dc38b55746627d",
|
||||
"96MAePnF8ppQm8165ABvzSEShnNy3vgxjmMhcqEkQVZ9FtPV2XL",
|
||||
"73423bf1fa6526ee571f3b4b4ad19799c81d40ce5c18a37d87dc38b55746627d",
|
||||
{
|
||||
"isCompressed": false,
|
||||
"isPrivkey": true,
|
||||
"isCompressed": false,
|
||||
"isPrivkey": true,
|
||||
"isTestnet": true
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"ckaDjxhDsVyZTHLUF7uoojCXVYcciUGeEk53VFzKUJsKUKhnbUnZ",
|
||||
"ae03398655b29f80badf1e6909e75ccf9bcdb6062e8886d0aca4b3d46a82aa830",
|
||||
"ckaDjxhDsVyZTHLUF7uoojCXVYcciUGeEk53VFzKUJsKUKhnbUnZ",
|
||||
"ae03398655b29f80badf1e6909e75ccf9bcdb6062e8886d0aca4b3d46a82aa830",
|
||||
{
|
||||
"isCompressed": true,
|
||||
"isPrivkey": true,
|
||||
"isCompressed": true,
|
||||
"isPrivkey": true,
|
||||
"isTestnet": true
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"DBjW6kna7rUPE4Mj9j4B3oK3xVA1SDHrdt",
|
||||
"485290865b407657e0aedbdbb4aa6618310af50d",
|
||||
"DBjW6kna7rUPE4Mj9j4B3oK3xVA1SDHrdt",
|
||||
"485290865b407657e0aedbdbb4aa6618310af50d",
|
||||
{
|
||||
"addrType": "pubkey",
|
||||
"isPrivkey": false,
|
||||
"addrType": "pubkey",
|
||||
"isPrivkey": false,
|
||||
"isTestnet": false
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"A3RHoAQLPDSuBewbuvt5NMqEKasqs9ty3C",
|
||||
"7879ea0f1053bcbd4c60c88f922f76d27e622e1e",
|
||||
"A3RHoAQLPDSuBewbuvt5NMqEKasqs9ty3C",
|
||||
"7879ea0f1053bcbd4c60c88f922f76d27e622e1e",
|
||||
{
|
||||
"addrType": "script",
|
||||
"isPrivkey": false,
|
||||
"addrType": "script",
|
||||
"isPrivkey": false,
|
||||
"isTestnet": false
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"ngbSgr1dhCqsLg6Z5tpsaCspwrH72x2Zk3",
|
||||
"8808c94daaa2e4f53102703b2c3de534d670e87e",
|
||||
"ngbSgr1dhCqsLg6Z5tpsaCspwrH72x2Zk3",
|
||||
"8808c94daaa2e4f53102703b2c3de534d670e87e",
|
||||
{
|
||||
"addrType": "pubkey",
|
||||
"isPrivkey": false,
|
||||
"addrType": "pubkey",
|
||||
"isPrivkey": false,
|
||||
"isTestnet": true
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"2MvY1BBau2C6jRC1hNX5LmviLrpvVG386TM",
|
||||
"2414c0f3862d25178830fb1ae01d982b8385eea4",
|
||||
"2MvY1BBau2C6jRC1hNX5LmviLrpvVG386TM",
|
||||
"2414c0f3862d25178830fb1ae01d982b8385eea4",
|
||||
{
|
||||
"addrType": "script",
|
||||
"isPrivkey": false,
|
||||
"addrType": "script",
|
||||
"isPrivkey": false,
|
||||
"isTestnet": true
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"6KVnGBP927t1rfowDpRcqYyE7WUX9w814iCNyYwtQEqKxEq8kBa",
|
||||
"b3bf28e85693936da055bc47e846657173e08ad30e143aaf2825ebacac325d6a",
|
||||
"6KVnGBP927t1rfowDpRcqYyE7WUX9w814iCNyYwtQEqKxEq8kBa",
|
||||
"b3bf28e85693936da055bc47e846657173e08ad30e143aaf2825ebacac325d6a",
|
||||
{
|
||||
"isCompressed": false,
|
||||
"isPrivkey": true,
|
||||
"isCompressed": false,
|
||||
"isPrivkey": true,
|
||||
"isTestnet": false
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"QVi86rdL3APa6TXXwPdRnKfqVfzGv6a993E5LeiHXaGGjE7cpah1",
|
||||
"d3b068bb594f19c1c70931d8aa19ab774147f946021737c988cafb51980f53fa0",
|
||||
"QVi86rdL3APa6TXXwPdRnKfqVfzGv6a993E5LeiHXaGGjE7cpah1",
|
||||
"d3b068bb594f19c1c70931d8aa19ab774147f946021737c988cafb51980f53fa0",
|
||||
{
|
||||
"isCompressed": true,
|
||||
"isPrivkey": true,
|
||||
"isCompressed": true,
|
||||
"isPrivkey": true,
|
||||
"isTestnet": false
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"95zguKdTJ9FznRvT4oUuBdqUxfrXe6qZby53E1GKsc1y5K713pe",
|
||||
"44c29c1910335047e44cf55d71d6a98b9935014016820532f067b6546b619cbf",
|
||||
"95zguKdTJ9FznRvT4oUuBdqUxfrXe6qZby53E1GKsc1y5K713pe",
|
||||
"44c29c1910335047e44cf55d71d6a98b9935014016820532f067b6546b619cbf",
|
||||
{
|
||||
"isCompressed": false,
|
||||
"isPrivkey": true,
|
||||
"isCompressed": false,
|
||||
"isPrivkey": true,
|
||||
"isTestnet": true
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"cmcFP2C5YMhPQpxv3X2i6byHxt21VYyuju7kCiVmUXqihMPshNKe",
|
||||
"cce4b63fa376a9d9d1828919d8df8435bdda853193b7fc8eff997a1144bf8d6e0",
|
||||
"cmcFP2C5YMhPQpxv3X2i6byHxt21VYyuju7kCiVmUXqihMPshNKe",
|
||||
"cce4b63fa376a9d9d1828919d8df8435bdda853193b7fc8eff997a1144bf8d6e0",
|
||||
{
|
||||
"isCompressed": true,
|
||||
"isPrivkey": true,
|
||||
"isCompressed": true,
|
||||
"isPrivkey": true,
|
||||
"isTestnet": true
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"D77Z1nmgSZxJTmtN65n2MVF9yvLSB4MpiC",
|
||||
"15a585042e96300b5ad4f9d7c7c6cba2d56a0989",
|
||||
"D77Z1nmgSZxJTmtN65n2MVF9yvLSB4MpiC",
|
||||
"15a585042e96300b5ad4f9d7c7c6cba2d56a0989",
|
||||
{
|
||||
"addrType": "pubkey",
|
||||
"isPrivkey": false,
|
||||
"addrType": "pubkey",
|
||||
"isPrivkey": false,
|
||||
"isTestnet": false
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"9zYnVRaekPtdKBYuPw5QiBtv3NNrzD2LLW",
|
||||
"58fc66bf64b3c8d8accd80110bb6df6c13735937",
|
||||
"9zYnVRaekPtdKBYuPw5QiBtv3NNrzD2LLW",
|
||||
"58fc66bf64b3c8d8accd80110bb6df6c13735937",
|
||||
{
|
||||
"addrType": "script",
|
||||
"isPrivkey": false,
|
||||
"addrType": "script",
|
||||
"isPrivkey": false,
|
||||
"isTestnet": false
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"ngao4q8auS6YuDKYPkzjt7zKYYT8LzkGZS",
|
||||
"87e961c7a75c7048de3758ad6723d5e047a0a66d",
|
||||
"ngao4q8auS6YuDKYPkzjt7zKYYT8LzkGZS",
|
||||
"87e961c7a75c7048de3758ad6723d5e047a0a66d",
|
||||
{
|
||||
"addrType": "pubkey",
|
||||
"isPrivkey": false,
|
||||
"addrType": "pubkey",
|
||||
"isPrivkey": false,
|
||||
"isTestnet": true
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"2N22vuiMGhfqD77vPqsXPiALBfn6oUTtFtH",
|
||||
"6065e2440e0b5dcb108e4eb019777e1a8377cd22",
|
||||
"2N22vuiMGhfqD77vPqsXPiALBfn6oUTtFtH",
|
||||
"6065e2440e0b5dcb108e4eb019777e1a8377cd22",
|
||||
{
|
||||
"addrType": "script",
|
||||
"isPrivkey": false,
|
||||
"addrType": "script",
|
||||
"isPrivkey": false,
|
||||
"isTestnet": true
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"6Jz9frVjB2g4F7tALvkt6yytWo5vQbLeGdvHPP3TRtZ8NDz7ayS",
|
||||
"70775592babf3ce95769229e6735a4b57e0c6b78f2c2dc7fb67b59e85ea7bd03",
|
||||
"6Jz9frVjB2g4F7tALvkt6yytWo5vQbLeGdvHPP3TRtZ8NDz7ayS",
|
||||
"70775592babf3ce95769229e6735a4b57e0c6b78f2c2dc7fb67b59e85ea7bd03",
|
||||
{
|
||||
"isCompressed": false,
|
||||
"isPrivkey": true,
|
||||
"isCompressed": false,
|
||||
"isPrivkey": true,
|
||||
"isTestnet": false
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"QPyvGzBensKS63stwvzsxrqQafwdFtYYqqmDhuxySpY1jkEKZ6kr",
|
||||
"28ca745f92b0b9b2ca2b4ebe566b665b3fca522855482c840f457b2a6cef55350",
|
||||
"QPyvGzBensKS63stwvzsxrqQafwdFtYYqqmDhuxySpY1jkEKZ6kr",
|
||||
"28ca745f92b0b9b2ca2b4ebe566b665b3fca522855482c840f457b2a6cef55350",
|
||||
{
|
||||
"isCompressed": true,
|
||||
"isPrivkey": true,
|
||||
"isCompressed": true,
|
||||
"isPrivkey": true,
|
||||
"isTestnet": false
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"96SJY1FrWHRvDuWtAMCbfZPqUkA6JxQpqjihjpbwrqFYcmLBuMW",
|
||||
"7eebb40de099f1feef864f880835b5d8614ad5cf3fd1e8a113b920ce6876496d",
|
||||
"96SJY1FrWHRvDuWtAMCbfZPqUkA6JxQpqjihjpbwrqFYcmLBuMW",
|
||||
"7eebb40de099f1feef864f880835b5d8614ad5cf3fd1e8a113b920ce6876496d",
|
||||
{
|
||||
"isCompressed": false,
|
||||
"isPrivkey": true,
|
||||
"isCompressed": false,
|
||||
"isPrivkey": true,
|
||||
"isTestnet": true
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"cjN4SQ4pHBLNnsyDPwjTPRTtoPN4YZoSthpAs2ysuF8kLnUYc12C",
|
||||
"89eb5ff85053c07eb1feefea07ea106564e0229e3b2c99d88f2f89c884dd7a390",
|
||||
"cjN4SQ4pHBLNnsyDPwjTPRTtoPN4YZoSthpAs2ysuF8kLnUYc12C",
|
||||
"89eb5ff85053c07eb1feefea07ea106564e0229e3b2c99d88f2f89c884dd7a390",
|
||||
{
|
||||
"isCompressed": true,
|
||||
"isPrivkey": true,
|
||||
"isCompressed": true,
|
||||
"isPrivkey": true,
|
||||
"isTestnet": true
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"DGYdw7jC17b9SappjsrAsaghhDTS8sV5Mx",
|
||||
"7d1d283ff32f3a425ea22d21032e1bca7d14efaa",
|
||||
"DGYdw7jC17b9SappjsrAsaghhDTS8sV5Mx",
|
||||
"7d1d283ff32f3a425ea22d21032e1bca7d14efaa",
|
||||
{
|
||||
"addrType": "pubkey",
|
||||
"isPrivkey": false,
|
||||
"addrType": "pubkey",
|
||||
"isPrivkey": false,
|
||||
"isTestnet": false
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"A3YUuiZjn3FzW2i6KqFVgHaN5r5fjvwEJ1",
|
||||
"79d61a4a63956139414b4e0698588cfb2c3466bf",
|
||||
"A3YUuiZjn3FzW2i6KqFVgHaN5r5fjvwEJ1",
|
||||
"79d61a4a63956139414b4e0698588cfb2c3466bf",
|
||||
{
|
||||
"addrType": "script",
|
||||
"isPrivkey": false,
|
||||
"addrType": "script",
|
||||
"isPrivkey": false,
|
||||
"isTestnet": false
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"nbo7vyCuiMxiYW4thwwuaTHQdCoqinmzJz",
|
||||
"53657de94e3b0ecf22a3188e1bc220b7ba0bbff9",
|
||||
"nbo7vyCuiMxiYW4thwwuaTHQdCoqinmzJz",
|
||||
"53657de94e3b0ecf22a3188e1bc220b7ba0bbff9",
|
||||
{
|
||||
"addrType": "pubkey",
|
||||
"isPrivkey": false,
|
||||
"addrType": "pubkey",
|
||||
"isPrivkey": false,
|
||||
"isTestnet": true
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"2N1Gz97rN7P6VCj9xf64wWFqQZgpUng1mM3",
|
||||
"5816475b6d3419099db394dfd9b81200d6618b9c",
|
||||
"2N1Gz97rN7P6VCj9xf64wWFqQZgpUng1mM3",
|
||||
"5816475b6d3419099db394dfd9b81200d6618b9c",
|
||||
{
|
||||
"addrType": "script",
|
||||
"isPrivkey": false,
|
||||
"addrType": "script",
|
||||
"isPrivkey": false,
|
||||
"isTestnet": true
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"6Kr2pQ4e9nGGZH8zYZMGWbeM4bft4L8efsg4jhN3rhMCJfB2Pkx",
|
||||
"e1ba9f4402a578bcb09701757b49ce37017510d2cc304db3027bb9bcc932fdff",
|
||||
"6Kr2pQ4e9nGGZH8zYZMGWbeM4bft4L8efsg4jhN3rhMCJfB2Pkx",
|
||||
"e1ba9f4402a578bcb09701757b49ce37017510d2cc304db3027bb9bcc932fdff",
|
||||
{
|
||||
"isCompressed": false,
|
||||
"isPrivkey": true,
|
||||
"isCompressed": false,
|
||||
"isPrivkey": true,
|
||||
"isTestnet": false
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"QUsNNw934sS8DjjTNKAkpZbN2RUFW1YaNz6PHYgkFMaj8uWhCuLc",
|
||||
"ba9bb7f48969e94301025313c298916b2913fb7eecefe98b9128ef4d87e40ea40",
|
||||
"QUsNNw934sS8DjjTNKAkpZbN2RUFW1YaNz6PHYgkFMaj8uWhCuLc",
|
||||
"ba9bb7f48969e94301025313c298916b2913fb7eecefe98b9128ef4d87e40ea40",
|
||||
{
|
||||
"isCompressed": true,
|
||||
"isPrivkey": true,
|
||||
"isCompressed": true,
|
||||
"isPrivkey": true,
|
||||
"isTestnet": false
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"979GQk1egwDTfCWnzeyNVxEiqfoKBudz1FRVooEzcTCb8JA9dau",
|
||||
"dbeedb336fb0f76b3de009d248fcf55d2a0a73ccf75096aa997248915fc03371",
|
||||
"979GQk1egwDTfCWnzeyNVxEiqfoKBudz1FRVooEzcTCb8JA9dau",
|
||||
"dbeedb336fb0f76b3de009d248fcf55d2a0a73ccf75096aa997248915fc03371",
|
||||
{
|
||||
"isCompressed": false,
|
||||
"isPrivkey": true,
|
||||
"isCompressed": false,
|
||||
"isPrivkey": true,
|
||||
"isTestnet": true
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"cf2NrvygA68y6ZCAkW2ueCuQ1B8qzyWpjGY38qhjvQgZAFLhRWGB",
|
||||
"0871ca5e089defd44b5076eecb20dcccaa9c97ad53253595d8957239c11410fb0",
|
||||
"cf2NrvygA68y6ZCAkW2ueCuQ1B8qzyWpjGY38qhjvQgZAFLhRWGB",
|
||||
"0871ca5e089defd44b5076eecb20dcccaa9c97ad53253595d8957239c11410fb0",
|
||||
{
|
||||
"isCompressed": true,
|
||||
"isPrivkey": true,
|
||||
"isCompressed": true,
|
||||
"isPrivkey": true,
|
||||
"isTestnet": true
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"DExWunrSkF2P9NAzW4JpEeC38uC3z36cCk",
|
||||
"6bb106bf7cc3f80e5cfeb3eacdd8f7dd9201fa09",
|
||||
"DExWunrSkF2P9NAzW4JpEeC38uC3z36cCk",
|
||||
"6bb106bf7cc3f80e5cfeb3eacdd8f7dd9201fa09",
|
||||
{
|
||||
"addrType": "pubkey",
|
||||
"isPrivkey": false,
|
||||
"addrType": "pubkey",
|
||||
"isPrivkey": false,
|
||||
"isTestnet": false
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"AFVkW8WgPP2rsTdAeyogFK9k8gXJ1LZwrb",
|
||||
"fcf36180b62ef220a182b1b246571bb2fce30ec8",
|
||||
"AFVkW8WgPP2rsTdAeyogFK9k8gXJ1LZwrb",
|
||||
"fcf36180b62ef220a182b1b246571bb2fce30ec8",
|
||||
{
|
||||
"addrType": "script",
|
||||
"isPrivkey": false,
|
||||
"addrType": "script",
|
||||
"isPrivkey": false,
|
||||
"isTestnet": false
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"nagGnGDKWYpvnphf9rgo3xtQhAxiEM1QGD",
|
||||
"4721d78285d03bbb968537f80426b5af244e1c31",
|
||||
"nagGnGDKWYpvnphf9rgo3xtQhAxiEM1QGD",
|
||||
"4721d78285d03bbb968537f80426b5af244e1c31",
|
||||
{
|
||||
"addrType": "pubkey",
|
||||
"isPrivkey": false,
|
||||
"addrType": "pubkey",
|
||||
"isPrivkey": false,
|
||||
"isTestnet": true
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"2N2f7vA5j92GCGuNt868zihqDBexEdDmJ8V",
|
||||
"673e0c152e1677a9a8fd55df78bb1eab3db3c53c",
|
||||
"2N2f7vA5j92GCGuNt868zihqDBexEdDmJ8V",
|
||||
"673e0c152e1677a9a8fd55df78bb1eab3db3c53c",
|
||||
{
|
||||
"addrType": "script",
|
||||
"isPrivkey": false,
|
||||
"addrType": "script",
|
||||
"isPrivkey": false,
|
||||
"isTestnet": true
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"6KaPu5s64YkVCz5n4oc5FEFVL6qVCh9a8Sdd6BYoE1SN2awEgb5",
|
||||
"be396d0ed750dc736ef1cabd65e813b3bf7417d21159919f49dd7cd2fa6b467e",
|
||||
"6KaPu5s64YkVCz5n4oc5FEFVL6qVCh9a8Sdd6BYoE1SN2awEgb5",
|
||||
"be396d0ed750dc736ef1cabd65e813b3bf7417d21159919f49dd7cd2fa6b467e",
|
||||
{
|
||||
"isCompressed": false,
|
||||
"isPrivkey": true,
|
||||
"isCompressed": false,
|
||||
"isPrivkey": true,
|
||||
"isTestnet": false
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"QRy3VpfeQ9hynFuZe7wJ7aPUNTtFmLrXoWQDtUY7fkoFQsNDLiTu",
|
||||
"6403e70451390134f2bddbe5ecb33c5b264af292fcbf2cdd97deaac7e1e8f7ba0",
|
||||
"QRy3VpfeQ9hynFuZe7wJ7aPUNTtFmLrXoWQDtUY7fkoFQsNDLiTu",
|
||||
"6403e70451390134f2bddbe5ecb33c5b264af292fcbf2cdd97deaac7e1e8f7ba0",
|
||||
{
|
||||
"isCompressed": true,
|
||||
"isPrivkey": true,
|
||||
"isCompressed": true,
|
||||
"isPrivkey": true,
|
||||
"isTestnet": false
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"96fTvLn3vYVp3ztgSEJdH4LfUNUvNdGav8SGD1hzpuupXVQuEWm",
|
||||
"9cce64818e4d50f761d1fcb230e9b8a0f20fc09c00c87e6a704cbfc5dd063489",
|
||||
"96fTvLn3vYVp3ztgSEJdH4LfUNUvNdGav8SGD1hzpuupXVQuEWm",
|
||||
"9cce64818e4d50f761d1fcb230e9b8a0f20fc09c00c87e6a704cbfc5dd063489",
|
||||
{
|
||||
"isCompressed": false,
|
||||
"isPrivkey": true,
|
||||
"isCompressed": false,
|
||||
"isPrivkey": true,
|
||||
"isTestnet": true
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"ckoubjh1yr1Hyg8NPtGwDz4tx91b6qztxrJZgTtdR4Ed9CqAV5cn",
|
||||
"b50dc6e116f4f4ae8b05fa6cb197cdfd27bd0c61e1c53c1ca83fcb9b56d59a830",
|
||||
"ckoubjh1yr1Hyg8NPtGwDz4tx91b6qztxrJZgTtdR4Ed9CqAV5cn",
|
||||
"b50dc6e116f4f4ae8b05fa6cb197cdfd27bd0c61e1c53c1ca83fcb9b56d59a830",
|
||||
{
|
||||
"isCompressed": true,
|
||||
"isPrivkey": true,
|
||||
"isCompressed": true,
|
||||
"isPrivkey": true,
|
||||
"isTestnet": true
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"DMYFDsuFamS4kogsiqxQRXK9diCfmJzNLh",
|
||||
"b3e2d3f49932081bd0a9936d0cc239aafed51a64",
|
||||
"DMYFDsuFamS4kogsiqxQRXK9diCfmJzNLh",
|
||||
"b3e2d3f49932081bd0a9936d0cc239aafed51a64",
|
||||
{
|
||||
"addrType": "pubkey",
|
||||
"isPrivkey": false,
|
||||
"addrType": "pubkey",
|
||||
"isPrivkey": false,
|
||||
"isTestnet": false
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"A2CUbyEtqGUjngAjxpGmM5Nwhrz72gh23v",
|
||||
"6b1566fa4c70a69df12bacc138efffd9b9cb0e72",
|
||||
"A2CUbyEtqGUjngAjxpGmM5Nwhrz72gh23v",
|
||||
"6b1566fa4c70a69df12bacc138efffd9b9cb0e72",
|
||||
{
|
||||
"addrType": "script",
|
||||
"isPrivkey": false,
|
||||
"addrType": "script",
|
||||
"isPrivkey": false,
|
||||
"isTestnet": false
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"nics7FiGssSKTuDrfNbHXa913W4LrLLK2w",
|
||||
"9e3dd6e04d1a35b84740e9a1b71c2809f7c578d4",
|
||||
"nics7FiGssSKTuDrfNbHXa913W4LrLLK2w",
|
||||
"9e3dd6e04d1a35b84740e9a1b71c2809f7c578d4",
|
||||
{
|
||||
"addrType": "pubkey",
|
||||
"isPrivkey": false,
|
||||
"addrType": "pubkey",
|
||||
"isPrivkey": false,
|
||||
"isTestnet": true
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"2MtHzsXQHKJCW6s6MikTVM14kk8aqF3WmZv",
|
||||
"0b7e6cae84a027bdb60c9d6760c329b98ce87d45",
|
||||
"2MtHzsXQHKJCW6s6MikTVM14kk8aqF3WmZv",
|
||||
"0b7e6cae84a027bdb60c9d6760c329b98ce87d45",
|
||||
{
|
||||
"addrType": "script",
|
||||
"isPrivkey": false,
|
||||
"addrType": "script",
|
||||
"isPrivkey": false,
|
||||
"isTestnet": true
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"6KWRvmWB1YXTp54zTKBPS4QUHbag7aP2CKkJ5eN7YqFcfFRjFaM",
|
||||
"b538a4cc390ca5c29bf2cb06d5b851418aa2eef0e175e0b655dadcfd6b9f0284",
|
||||
"6KWRvmWB1YXTp54zTKBPS4QUHbag7aP2CKkJ5eN7YqFcfFRjFaM",
|
||||
"b538a4cc390ca5c29bf2cb06d5b851418aa2eef0e175e0b655dadcfd6b9f0284",
|
||||
{
|
||||
"isCompressed": false,
|
||||
"isPrivkey": true,
|
||||
"isCompressed": false,
|
||||
"isPrivkey": true,
|
||||
"isTestnet": false
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"QVDwi7RFwB1hL2upnnEBn1HjaTexNWSYtkYpdE1VhcY3n7faQ32D",
|
||||
"c531526045e4585f3893dfa6e6e6b71af4fa517ba280039b35667b60a95de9e20",
|
||||
"QVDwi7RFwB1hL2upnnEBn1HjaTexNWSYtkYpdE1VhcY3n7faQ32D",
|
||||
"c531526045e4585f3893dfa6e6e6b71af4fa517ba280039b35667b60a95de9e20",
|
||||
{
|
||||
"isCompressed": true,
|
||||
"isPrivkey": true,
|
||||
"isCompressed": true,
|
||||
"isPrivkey": true,
|
||||
"isTestnet": false
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"95cdHztwpWKgA4dgw8chw9hjR4yjxNFZrPr9otqgPL5mH9PGesJ",
|
||||
"12aa4b855eedc7026fb706ec1598023d04e95256c7beebd6556fbe9493be4d61",
|
||||
"95cdHztwpWKgA4dgw8chw9hjR4yjxNFZrPr9otqgPL5mH9PGesJ",
|
||||
"12aa4b855eedc7026fb706ec1598023d04e95256c7beebd6556fbe9493be4d61",
|
||||
{
|
||||
"isCompressed": false,
|
||||
"isPrivkey": true,
|
||||
"isCompressed": false,
|
||||
"isPrivkey": true,
|
||||
"isTestnet": true
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"ckrhHfB5k7NzVEqEsksYGvh2xSjZiT71oVGGSysP97bGMCkm3EgK",
|
||||
"b67ce8f38601e2f35bcca9b9cc9ac7f5ed7bfad783cf8ecdb21a1f912086cf4d0",
|
||||
"ckrhHfB5k7NzVEqEsksYGvh2xSjZiT71oVGGSysP97bGMCkm3EgK",
|
||||
"b67ce8f38601e2f35bcca9b9cc9ac7f5ed7bfad783cf8ecdb21a1f912086cf4d0",
|
||||
{
|
||||
"isCompressed": true,
|
||||
"isPrivkey": true,
|
||||
"isCompressed": true,
|
||||
"isPrivkey": true,
|
||||
"isTestnet": true
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"DQJXChtyuN3aiU3W6pG4mgnykisHH5hqst",
|
||||
"d232b89955f8f77e27eea5b818c459aa8f8d364d",
|
||||
"DQJXChtyuN3aiU3W6pG4mgnykisHH5hqst",
|
||||
"d232b89955f8f77e27eea5b818c459aa8f8d364d",
|
||||
{
|
||||
"addrType": "pubkey",
|
||||
"isPrivkey": false,
|
||||
"addrType": "pubkey",
|
||||
"isPrivkey": false,
|
||||
"isTestnet": false
|
||||
}
|
||||
],
|
||||
],
|
||||
[
|
||||
"AD21pKoCWcrqrUW4oRv5xUaGwCfXhiyx6y",
|
||||
"e1c443feb1eede60962dc808899086f8dc589336",
|
||||
"AD21pKoCWcrqrUW4oRv5xUaGwCfXhiyx6y",
|
||||
"e1c443feb1eede60962dc808899086f8dc589336",
|
||||
{
|
||||
"addrType": "script",
|
||||
"isPrivkey": false,
|
||||
"addrType": "script",
|
||||
"isPrivkey": false,
|
||||
"isTestnet": false
|
||||
}
|
||||
]
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
"hex": "493046022100b4251ecd63778a3dde0155abe4cd162947620ae9ee45a874353551092325b116022100db307baf4ff3781ec520bd18f387948cedd15dc27bafe17c894b0fe6ffffcafa012103091137f3ef23f4acfc19a5953a68b2074fae942ad3563ef28c33b0cac9a93adc"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "752f7f69b915637dc1c2f7aed1466ad676f6f3e24cf922809705f664e97ab3c1",
|
||||
"vout": 1,
|
||||
|
@ -21,7 +21,7 @@
|
|||
"hex": "473044022079bd62ee09621a3be96b760c39e8ef78170101d46313923c6b07ae60a95c90670220238e51ea29fc70b04b65508450523caedbb11cb4dd5aa608c81487de798925ba0121027a759be8df971a6a04fafcb4f6babf75dc811c5cdaa0734cddbe9b942ce75b34"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "b0ac9cca2e69cd02410e31b1f4402a25758e71abd1ab06c265ef9077dc05d0ed",
|
||||
"vout": 209,
|
||||
|
@ -30,7 +30,7 @@
|
|||
"hex": "48304502207722d6f9038673c86a1019b1c4de2d687ae246477cd4ca7002762be0299de385022100e594a11e3a313942595f7666dcf7078bcb14f1330f4206b95c917e7ec0e82fac012103091137f3ef23f4acfc19a5953a68b2074fae942ad3563ef28c33b0cac9a93adc"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "a135eafb595eaf4c1ea59ccb111cdc0eae1b2c979b226a1e5aa8b76fe2d628df",
|
||||
"vout": 0,
|
||||
|
@ -39,7 +39,7 @@
|
|||
"hex": "483045022100a63a4788027b79b65c6f9d9e054f68cf3b4eed19efd82a2d53f70dcbe64683390220526f243671425b2bd05745fcf2729361f985cfe84ea80c7cfc817b93d8134374012103a621f08be22d1bbdcbe4e527ee4927006aa555fc65e2aafa767d4ea2fe9dfa52"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "a5d6bf53ba21140b8a4d554feb00fe8bb9a62430ff9e4624aa2f58a120232aae",
|
||||
"vout": 1,
|
||||
|
@ -48,7 +48,7 @@
|
|||
"hex": "493046022100b200ac6db16842f76dab9abe807ce423c992805879bc50abd46ed8275a59d9cf022100c0d518e85dd345b3c29dd4dc47b9a420d3ce817b18720e94966d2fe23413a408012103091137f3ef23f4acfc19a5953a68b2074fae942ad3563ef28c33b0cac9a93adc"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "1b299cf14f1a22e81ea56d71b7affbd7cf386807bf2b4d4b79a18a54125accb3",
|
||||
"vout": 0,
|
||||
|
@ -57,7 +57,7 @@
|
|||
"hex": "483045022100ededc441c3103a6f2bd6cab7639421af0f6ec5e60503bce1e603cf34f00aee1c02205cb75f3f519a13fb348783b21db3085cb5ec7552c59e394fdbc3e1feea43f967012103a621f08be22d1bbdcbe4e527ee4927006aa555fc65e2aafa767d4ea2fe9dfa52"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "071df1cdcb3f0070f9d6af7b0274f02d0be2324a274727cfd288383167531485",
|
||||
"vout": 21,
|
||||
|
@ -66,7 +66,7 @@
|
|||
"hex": "483045022100d9eed5413d2a4b4b98625aa6e3169edc4fb4663e7862316d69224454e70cd8ca022061e506521d5ced51dd0ea36496e75904d756a4c4f9fb111568555075d5f68d9a012103f1575d6124ac78be398c25b31146d08313c6072d23a4d7df5ac6a9f87346c64c"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "b012e500eb7adf7a13ed332dd6ece849f94f7a62bb3eac5babab356d1fc19282",
|
||||
"vout": 9,
|
||||
|
@ -75,7 +75,7 @@
|
|||
"hex": "48304502207e84b27139c4c19c828cb1e30c349bba88e4d9b59be97286960793b5ddc0a2af0221008cdc7a951e7f31c20953ed5635fbabf228e80b7047f32faaa0313e7693005177012103f1575d6124ac78be398c25b31146d08313c6072d23a4d7df5ac6a9f87346c64c"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "58840fee9c833f2f2d40575842f30f4b8d2553094d06ad88b03d06869acf3d88",
|
||||
"vout": 30,
|
||||
|
@ -84,7 +84,7 @@
|
|||
"hex": "4730440220426540dfed9c4ab5812e5f06df705b8bcf307dd7d20f7fa6512298b2a6314f420220064055096e3ca62f6c7352c66a5447767c53f946acdf35025ab3807ddb2fa404012103f1575d6124ac78be398c25b31146d08313c6072d23a4d7df5ac6a9f87346c64c"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "e69f9cd16946e570a665245354428a3f507ea69f4568b581e4af98edb3db9766",
|
||||
"vout": 114,
|
||||
|
@ -93,7 +93,7 @@
|
|||
"hex": "47304402200a5e673996f2fc88e21cc8613611f08a650bc0370338803591d85d0ec5663764022040b6664a0d1ec83a7f01975b8fde5232992b8ca58bf48af6725d2f92a936ab2e012103f1575d6124ac78be398c25b31146d08313c6072d23a4d7df5ac6a9f87346c64c"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "595d1257f654ed2cbe5a65421e8aefd2b4d70b5b6c89a03f1d7e518221fc3f02",
|
||||
"vout": 103,
|
||||
|
@ -102,7 +102,7 @@
|
|||
"hex": "493046022100d93b30219c5735f673be5c3b4688366d96f545561c74cb62c6958c00f6960806022100ec8200adcb028f2184fa2a4f6faac7f8bb57cb4503bb7584ac11051fece31b3d012103091137f3ef23f4acfc19a5953a68b2074fae942ad3563ef28c33b0cac9a93adc"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "06fc818f9555a261248ecd7aad0993eafb5a82ceb2b5c87c3ddfb06671c7f816",
|
||||
"vout": 1,
|
||||
|
@ -111,7 +111,7 @@
|
|||
"hex": "483045022100a13934e68d3f5b22b130c4cb33f4da468cffc52323a47fbfbe06b64858162246022047081e0a70ff770e64a2e2d31e5d520d9102268b57a47009a72fe73ec766901801210234b9d9413f247bb78cd3293b7b65a2c38018ba5621ea9ee737f3a6a3523fb4cd"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "fb416c8155d6bb1d43f9395466ca90a638a7c2dd3ff617aadf3a7ac8f3967b19",
|
||||
"vout": 0,
|
||||
|
@ -120,7 +120,7 @@
|
|||
"hex": "49304602210097f1f35d5bdc1a3a60390a1b015b8e7c4f916aa3847aafd969e04975e15bbe70022100a9052eb25517d481f1fda1b129eb1b534da50ea1a51f3ee012dca3601c11b86a0121027a759be8df971a6a04fafcb4f6babf75dc811c5cdaa0734cddbe9b942ce75b34"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "3940b9683bd6104ad24c978e640ba4095993cafdb27d2ed91baa27ee61a2d920",
|
||||
"vout": 221,
|
||||
|
@ -129,7 +129,7 @@
|
|||
"hex": "483045022012b3138c591bf7154b6fef457f2c4a3c7162225003788ac0024a99355865ff13022100b71b125ae1ffb2e1d1571f580cd3ebc8cd049a2d7a8a41f138ba94aeb982106f012103091137f3ef23f4acfc19a5953a68b2074fae942ad3563ef28c33b0cac9a93adc"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "711b5714d3b5136147c02194cd95bde94a4648c4263ca6f972d86cd1d579f150",
|
||||
"vout": 1,
|
||||
|
@ -138,7 +138,7 @@
|
|||
"hex": "483045022100f834ccc8b22ee72712a3e5e6ef4acb8b2fb791b5385b70e2cd4332674d6667f4022024fbda0a997e0c253503f217501f508a4d56edce2c813ecdd9ad796dbeba907401210234b9d9413f247bb78cd3293b7b65a2c38018ba5621ea9ee737f3a6a3523fb4cd"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "6364b5c5efe018430789e7fb4e338209546cae5d9c5f5e300aac68155d861b55",
|
||||
"vout": 27,
|
||||
|
@ -147,7 +147,7 @@
|
|||
"hex": "48304502203b2fd1e39ae0e469d7a15768f262661b0de41470daf0fe8c4fd0c26542a0870002210081c57e331f9a2d214457d953e3542904727ee412c63028113635d7224da3dccc012103f1575d6124ac78be398c25b31146d08313c6072d23a4d7df5ac6a9f87346c64c"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "0bb57f6e38012c86d4c5a28c904f2675082859147921a707d48961015a3e5057",
|
||||
"vout": 1095,
|
||||
|
@ -156,7 +156,7 @@
|
|||
"hex": "48304502206947a9c54f0664ece4430fd4ae999891dc50bb6126bc36b6a15a3189f29d25e9022100a86cfc4e2fdd9e39a20e305cfd1b76509c67b3e313e0f118229105caa0e823c9012103f1575d6124ac78be398c25b31146d08313c6072d23a4d7df5ac6a9f87346c64c"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "9b34274814a2540bb062107117f8f3e75ef85d953e9372d8261a3e9dfbc1163f",
|
||||
"vout": 37,
|
||||
|
@ -165,7 +165,7 @@
|
|||
"hex": "483045022100c7128fe10b2d38744ae8177776054c29fc8ec13f07207723e70766ab7164847402201d2cf09009b9596de74c0183d1ab832e5edddb7a9965880bb400097e850850f8012103f1575d6124ac78be398c25b31146d08313c6072d23a4d7df5ac6a9f87346c64c"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "b86b5cc0d8a7374d94e277850b0a249cb26a7b42ddf014f28a49b8859da64241",
|
||||
"vout": 20,
|
||||
|
@ -174,7 +174,7 @@
|
|||
"hex": "48304502203b89a71628a28cc3703d170ca3be77786cff6b867e38a18b719705f8a326578f022100b2a9879e1acf621faa6466c207746a7f3eb4c8514c1482969aba3f2a957f1321012103f1575d6124ac78be398c25b31146d08313c6072d23a4d7df5ac6a9f87346c64c"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "3d0a2353eeec44d3c10aed259038db321912122cd4150048f7bfa4c0ecfee236",
|
||||
"vout": 242,
|
||||
|
@ -198,7 +198,7 @@
|
|||
"DJFXow7CYcBWKVjwe1VH4or5f6YetLH1hw"
|
||||
]
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
"value": 0.01000001,
|
||||
"n": 1,
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
"hex": "493046022100b4251ecd63778a3dde0155abe4cd162947620ae9ee45a874353551092325b116022100db307baf4ff3781ec520bd18f387948cedd15dc27bafe17c894b0fe6ffffcafa012103091137f3ef23f4acfc19a5953a68b2074fae942ad3563ef28c33b0cac9a93adc"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "a72ec96bd0d022d1b0c2f9078cdd46b3725b8eecdd001e17b21e3ababad14ecb",
|
||||
"vout": 0,
|
||||
|
@ -21,7 +21,7 @@
|
|||
"hex": "493046022100a9b617843b68c284715d3e02fd120479cd0d96a6c43bf01e697fb0a460a21a3a022100ba0a12fbe8b993d4e7911fa3467615765dbe421ddf5c51b57a9c1ee19dcc00ba012103e633b4fa4ceb705c2da712390767199be8ef2448b3095dc01652e11b2b751505"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "752f7f69b915637dc1c2f7aed1466ad676f6f3e24cf922809705f664e97ab3c1",
|
||||
"vout": 1,
|
||||
|
@ -30,7 +30,7 @@
|
|||
"hex": "473044022079bd62ee09621a3be96b760c39e8ef78170101d46313923c6b07ae60a95c90670220238e51ea29fc70b04b65508450523caedbb11cb4dd5aa608c81487de798925ba0121027a759be8df971a6a04fafcb4f6babf75dc811c5cdaa0734cddbe9b942ce75b34"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "b0ac9cca2e69cd02410e31b1f4402a25758e71abd1ab06c265ef9077dc05d0ed",
|
||||
"vout": 209,
|
||||
|
@ -39,7 +39,7 @@
|
|||
"hex": "48304502207722d6f9038673c86a1019b1c4de2d687ae246477cd4ca7002762be0299de385022100e594a11e3a313942595f7666dcf7078bcb14f1330f4206b95c917e7ec0e82fac012103091137f3ef23f4acfc19a5953a68b2074fae942ad3563ef28c33b0cac9a93adc"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "a135eafb595eaf4c1ea59ccb111cdc0eae1b2c979b226a1e5aa8b76fe2d628df",
|
||||
"vout": 0,
|
||||
|
@ -48,7 +48,7 @@
|
|||
"hex": "483045022100a63a4788027b79b65c6f9d9e054f68cf3b4eed19efd82a2d53f70dcbe64683390220526f243671425b2bd05745fcf2729361f985cfe84ea80c7cfc817b93d8134374012103a621f08be22d1bbdcbe4e527ee4927006aa555fc65e2aafa767d4ea2fe9dfa52"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "a5d6bf53ba21140b8a4d554feb00fe8bb9a62430ff9e4624aa2f58a120232aae",
|
||||
"vout": 1,
|
||||
|
@ -57,7 +57,7 @@
|
|||
"hex": "493046022100b200ac6db16842f76dab9abe807ce423c992805879bc50abd46ed8275a59d9cf022100c0d518e85dd345b3c29dd4dc47b9a420d3ce817b18720e94966d2fe23413a408012103091137f3ef23f4acfc19a5953a68b2074fae942ad3563ef28c33b0cac9a93adc"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "1b299cf14f1a22e81ea56d71b7affbd7cf386807bf2b4d4b79a18a54125accb3",
|
||||
"vout": 0,
|
||||
|
@ -66,7 +66,7 @@
|
|||
"hex": "483045022100ededc441c3103a6f2bd6cab7639421af0f6ec5e60503bce1e603cf34f00aee1c02205cb75f3f519a13fb348783b21db3085cb5ec7552c59e394fdbc3e1feea43f967012103a621f08be22d1bbdcbe4e527ee4927006aa555fc65e2aafa767d4ea2fe9dfa52"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "071df1cdcb3f0070f9d6af7b0274f02d0be2324a274727cfd288383167531485",
|
||||
"vout": 21,
|
||||
|
@ -75,7 +75,7 @@
|
|||
"hex": "483045022100d9eed5413d2a4b4b98625aa6e3169edc4fb4663e7862316d69224454e70cd8ca022061e506521d5ced51dd0ea36496e75904d756a4c4f9fb111568555075d5f68d9a012103f1575d6124ac78be398c25b31146d08313c6072d23a4d7df5ac6a9f87346c64c"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "b012e500eb7adf7a13ed332dd6ece849f94f7a62bb3eac5babab356d1fc19282",
|
||||
"vout": 9,
|
||||
|
@ -84,7 +84,7 @@
|
|||
"hex": "48304502207e84b27139c4c19c828cb1e30c349bba88e4d9b59be97286960793b5ddc0a2af0221008cdc7a951e7f31c20953ed5635fbabf228e80b7047f32faaa0313e7693005177012103f1575d6124ac78be398c25b31146d08313c6072d23a4d7df5ac6a9f87346c64c"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "58840fee9c833f2f2d40575842f30f4b8d2553094d06ad88b03d06869acf3d88",
|
||||
"vout": 30,
|
||||
|
@ -93,7 +93,7 @@
|
|||
"hex": "4730440220426540dfed9c4ab5812e5f06df705b8bcf307dd7d20f7fa6512298b2a6314f420220064055096e3ca62f6c7352c66a5447767c53f946acdf35025ab3807ddb2fa404012103f1575d6124ac78be398c25b31146d08313c6072d23a4d7df5ac6a9f87346c64c"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "e69f9cd16946e570a665245354428a3f507ea69f4568b581e4af98edb3db9766",
|
||||
"vout": 114,
|
||||
|
@ -102,7 +102,7 @@
|
|||
"hex": "47304402200a5e673996f2fc88e21cc8613611f08a650bc0370338803591d85d0ec5663764022040b6664a0d1ec83a7f01975b8fde5232992b8ca58bf48af6725d2f92a936ab2e012103f1575d6124ac78be398c25b31146d08313c6072d23a4d7df5ac6a9f87346c64c"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "595d1257f654ed2cbe5a65421e8aefd2b4d70b5b6c89a03f1d7e518221fc3f02",
|
||||
"vout": 103,
|
||||
|
@ -111,7 +111,7 @@
|
|||
"hex": "493046022100d93b30219c5735f673be5c3b4688366d96f545561c74cb62c6958c00f6960806022100ec8200adcb028f2184fa2a4f6faac7f8bb57cb4503bb7584ac11051fece31b3d012103091137f3ef23f4acfc19a5953a68b2074fae942ad3563ef28c33b0cac9a93adc"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "06fc818f9555a261248ecd7aad0993eafb5a82ceb2b5c87c3ddfb06671c7f816",
|
||||
"vout": 1,
|
||||
|
@ -120,7 +120,7 @@
|
|||
"hex": "483045022100a13934e68d3f5b22b130c4cb33f4da468cffc52323a47fbfbe06b64858162246022047081e0a70ff770e64a2e2d31e5d520d9102268b57a47009a72fe73ec766901801210234b9d9413f247bb78cd3293b7b65a2c38018ba5621ea9ee737f3a6a3523fb4cd"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "fb416c8155d6bb1d43f9395466ca90a638a7c2dd3ff617aadf3a7ac8f3967b19",
|
||||
"vout": 0,
|
||||
|
@ -129,7 +129,7 @@
|
|||
"hex": "49304602210097f1f35d5bdc1a3a60390a1b015b8e7c4f916aa3847aafd969e04975e15bbe70022100a9052eb25517d481f1fda1b129eb1b534da50ea1a51f3ee012dca3601c11b86a0121027a759be8df971a6a04fafcb4f6babf75dc811c5cdaa0734cddbe9b942ce75b34"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "3940b9683bd6104ad24c978e640ba4095993cafdb27d2ed91baa27ee61a2d920",
|
||||
"vout": 221,
|
||||
|
@ -138,7 +138,7 @@
|
|||
"hex": "483045022012b3138c591bf7154b6fef457f2c4a3c7162225003788ac0024a99355865ff13022100b71b125ae1ffb2e1d1571f580cd3ebc8cd049a2d7a8a41f138ba94aeb982106f012103091137f3ef23f4acfc19a5953a68b2074fae942ad3563ef28c33b0cac9a93adc"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "711b5714d3b5136147c02194cd95bde94a4648c4263ca6f972d86cd1d579f150",
|
||||
"vout": 1,
|
||||
|
@ -147,7 +147,7 @@
|
|||
"hex": "483045022100f834ccc8b22ee72712a3e5e6ef4acb8b2fb791b5385b70e2cd4332674d6667f4022024fbda0a997e0c253503f217501f508a4d56edce2c813ecdd9ad796dbeba907401210234b9d9413f247bb78cd3293b7b65a2c38018ba5621ea9ee737f3a6a3523fb4cd"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "6364b5c5efe018430789e7fb4e338209546cae5d9c5f5e300aac68155d861b55",
|
||||
"vout": 27,
|
||||
|
@ -156,7 +156,7 @@
|
|||
"hex": "48304502203b2fd1e39ae0e469d7a15768f262661b0de41470daf0fe8c4fd0c26542a0870002210081c57e331f9a2d214457d953e3542904727ee412c63028113635d7224da3dccc012103f1575d6124ac78be398c25b31146d08313c6072d23a4d7df5ac6a9f87346c64c"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "0bb57f6e38012c86d4c5a28c904f2675082859147921a707d48961015a3e5057",
|
||||
"vout": 1095,
|
||||
|
@ -165,7 +165,7 @@
|
|||
"hex": "48304502206947a9c54f0664ece4430fd4ae999891dc50bb6126bc36b6a15a3189f29d25e9022100a86cfc4e2fdd9e39a20e305cfd1b76509c67b3e313e0f118229105caa0e823c9012103f1575d6124ac78be398c25b31146d08313c6072d23a4d7df5ac6a9f87346c64c"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "9b34274814a2540bb062107117f8f3e75ef85d953e9372d8261a3e9dfbc1163f",
|
||||
"vout": 37,
|
||||
|
@ -174,7 +174,7 @@
|
|||
"hex": "483045022100c7128fe10b2d38744ae8177776054c29fc8ec13f07207723e70766ab7164847402201d2cf09009b9596de74c0183d1ab832e5edddb7a9965880bb400097e850850f8012103f1575d6124ac78be398c25b31146d08313c6072d23a4d7df5ac6a9f87346c64c"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "b86b5cc0d8a7374d94e277850b0a249cb26a7b42ddf014f28a49b8859da64241",
|
||||
"vout": 20,
|
||||
|
@ -183,7 +183,7 @@
|
|||
"hex": "48304502203b89a71628a28cc3703d170ca3be77786cff6b867e38a18b719705f8a326578f022100b2a9879e1acf621faa6466c207746a7f3eb4c8514c1482969aba3f2a957f1321012103f1575d6124ac78be398c25b31146d08313c6072d23a4d7df5ac6a9f87346c64c"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "3d0a2353eeec44d3c10aed259038db321912122cd4150048f7bfa4c0ecfee236",
|
||||
"vout": 242,
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
"hex": "493046022100b4251ecd63778a3dde0155abe4cd162947620ae9ee45a874353551092325b116022100db307baf4ff3781ec520bd18f387948cedd15dc27bafe17c894b0fe6ffffcafa012103091137f3ef23f4acfc19a5953a68b2074fae942ad3563ef28c33b0cac9a93adc"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "a72ec96bd0d022d1b0c2f9078cdd46b3725b8eecdd001e17b21e3ababad14ecb",
|
||||
"vout": 0,
|
||||
|
@ -21,7 +21,7 @@
|
|||
"hex": "493046022100a9b617843b68c284715d3e02fd120479cd0d96a6c43bf01e697fb0a460a21a3a022100ba0a12fbe8b993d4e7911fa3467615765dbe421ddf5c51b57a9c1ee19dcc00ba012103e633b4fa4ceb705c2da712390767199be8ef2448b3095dc01652e11b2b751505"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "752f7f69b915637dc1c2f7aed1466ad676f6f3e24cf922809705f664e97ab3c1",
|
||||
"vout": 1,
|
||||
|
@ -30,7 +30,7 @@
|
|||
"hex": "473044022079bd62ee09621a3be96b760c39e8ef78170101d46313923c6b07ae60a95c90670220238e51ea29fc70b04b65508450523caedbb11cb4dd5aa608c81487de798925ba0121027a759be8df971a6a04fafcb4f6babf75dc811c5cdaa0734cddbe9b942ce75b34"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "b0ac9cca2e69cd02410e31b1f4402a25758e71abd1ab06c265ef9077dc05d0ed",
|
||||
"vout": 209,
|
||||
|
@ -39,7 +39,7 @@
|
|||
"hex": "48304502207722d6f9038673c86a1019b1c4de2d687ae246477cd4ca7002762be0299de385022100e594a11e3a313942595f7666dcf7078bcb14f1330f4206b95c917e7ec0e82fac012103091137f3ef23f4acfc19a5953a68b2074fae942ad3563ef28c33b0cac9a93adc"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "a135eafb595eaf4c1ea59ccb111cdc0eae1b2c979b226a1e5aa8b76fe2d628df",
|
||||
"vout": 0,
|
||||
|
@ -48,7 +48,7 @@
|
|||
"hex": "483045022100a63a4788027b79b65c6f9d9e054f68cf3b4eed19efd82a2d53f70dcbe64683390220526f243671425b2bd05745fcf2729361f985cfe84ea80c7cfc817b93d8134374012103a621f08be22d1bbdcbe4e527ee4927006aa555fc65e2aafa767d4ea2fe9dfa52"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "a5d6bf53ba21140b8a4d554feb00fe8bb9a62430ff9e4624aa2f58a120232aae",
|
||||
"vout": 1,
|
||||
|
@ -57,7 +57,7 @@
|
|||
"hex": "493046022100b200ac6db16842f76dab9abe807ce423c992805879bc50abd46ed8275a59d9cf022100c0d518e85dd345b3c29dd4dc47b9a420d3ce817b18720e94966d2fe23413a408012103091137f3ef23f4acfc19a5953a68b2074fae942ad3563ef28c33b0cac9a93adc"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "1b299cf14f1a22e81ea56d71b7affbd7cf386807bf2b4d4b79a18a54125accb3",
|
||||
"vout": 0,
|
||||
|
@ -66,7 +66,7 @@
|
|||
"hex": "483045022100ededc441c3103a6f2bd6cab7639421af0f6ec5e60503bce1e603cf34f00aee1c02205cb75f3f519a13fb348783b21db3085cb5ec7552c59e394fdbc3e1feea43f967012103a621f08be22d1bbdcbe4e527ee4927006aa555fc65e2aafa767d4ea2fe9dfa52"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "071df1cdcb3f0070f9d6af7b0274f02d0be2324a274727cfd288383167531485",
|
||||
"vout": 21,
|
||||
|
@ -75,7 +75,7 @@
|
|||
"hex": "483045022100d9eed5413d2a4b4b98625aa6e3169edc4fb4663e7862316d69224454e70cd8ca022061e506521d5ced51dd0ea36496e75904d756a4c4f9fb111568555075d5f68d9a012103f1575d6124ac78be398c25b31146d08313c6072d23a4d7df5ac6a9f87346c64c"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "b012e500eb7adf7a13ed332dd6ece849f94f7a62bb3eac5babab356d1fc19282",
|
||||
"vout": 9,
|
||||
|
@ -84,7 +84,7 @@
|
|||
"hex": "48304502207e84b27139c4c19c828cb1e30c349bba88e4d9b59be97286960793b5ddc0a2af0221008cdc7a951e7f31c20953ed5635fbabf228e80b7047f32faaa0313e7693005177012103f1575d6124ac78be398c25b31146d08313c6072d23a4d7df5ac6a9f87346c64c"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "58840fee9c833f2f2d40575842f30f4b8d2553094d06ad88b03d06869acf3d88",
|
||||
"vout": 30,
|
||||
|
@ -93,7 +93,7 @@
|
|||
"hex": "4730440220426540dfed9c4ab5812e5f06df705b8bcf307dd7d20f7fa6512298b2a6314f420220064055096e3ca62f6c7352c66a5447767c53f946acdf35025ab3807ddb2fa404012103f1575d6124ac78be398c25b31146d08313c6072d23a4d7df5ac6a9f87346c64c"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "e69f9cd16946e570a665245354428a3f507ea69f4568b581e4af98edb3db9766",
|
||||
"vout": 114,
|
||||
|
@ -102,7 +102,7 @@
|
|||
"hex": "47304402200a5e673996f2fc88e21cc8613611f08a650bc0370338803591d85d0ec5663764022040b6664a0d1ec83a7f01975b8fde5232992b8ca58bf48af6725d2f92a936ab2e012103f1575d6124ac78be398c25b31146d08313c6072d23a4d7df5ac6a9f87346c64c"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "595d1257f654ed2cbe5a65421e8aefd2b4d70b5b6c89a03f1d7e518221fc3f02",
|
||||
"vout": 103,
|
||||
|
@ -111,7 +111,7 @@
|
|||
"hex": "493046022100d93b30219c5735f673be5c3b4688366d96f545561c74cb62c6958c00f6960806022100ec8200adcb028f2184fa2a4f6faac7f8bb57cb4503bb7584ac11051fece31b3d012103091137f3ef23f4acfc19a5953a68b2074fae942ad3563ef28c33b0cac9a93adc"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "06fc818f9555a261248ecd7aad0993eafb5a82ceb2b5c87c3ddfb06671c7f816",
|
||||
"vout": 1,
|
||||
|
@ -120,7 +120,7 @@
|
|||
"hex": "483045022100a13934e68d3f5b22b130c4cb33f4da468cffc52323a47fbfbe06b64858162246022047081e0a70ff770e64a2e2d31e5d520d9102268b57a47009a72fe73ec766901801210234b9d9413f247bb78cd3293b7b65a2c38018ba5621ea9ee737f3a6a3523fb4cd"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "fb416c8155d6bb1d43f9395466ca90a638a7c2dd3ff617aadf3a7ac8f3967b19",
|
||||
"vout": 0,
|
||||
|
@ -129,7 +129,7 @@
|
|||
"hex": "49304602210097f1f35d5bdc1a3a60390a1b015b8e7c4f916aa3847aafd969e04975e15bbe70022100a9052eb25517d481f1fda1b129eb1b534da50ea1a51f3ee012dca3601c11b86a0121027a759be8df971a6a04fafcb4f6babf75dc811c5cdaa0734cddbe9b942ce75b34"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "3940b9683bd6104ad24c978e640ba4095993cafdb27d2ed91baa27ee61a2d920",
|
||||
"vout": 221,
|
||||
|
@ -138,7 +138,7 @@
|
|||
"hex": "483045022012b3138c591bf7154b6fef457f2c4a3c7162225003788ac0024a99355865ff13022100b71b125ae1ffb2e1d1571f580cd3ebc8cd049a2d7a8a41f138ba94aeb982106f012103091137f3ef23f4acfc19a5953a68b2074fae942ad3563ef28c33b0cac9a93adc"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "711b5714d3b5136147c02194cd95bde94a4648c4263ca6f972d86cd1d579f150",
|
||||
"vout": 1,
|
||||
|
@ -147,7 +147,7 @@
|
|||
"hex": "483045022100f834ccc8b22ee72712a3e5e6ef4acb8b2fb791b5385b70e2cd4332674d6667f4022024fbda0a997e0c253503f217501f508a4d56edce2c813ecdd9ad796dbeba907401210234b9d9413f247bb78cd3293b7b65a2c38018ba5621ea9ee737f3a6a3523fb4cd"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "6364b5c5efe018430789e7fb4e338209546cae5d9c5f5e300aac68155d861b55",
|
||||
"vout": 27,
|
||||
|
@ -156,7 +156,7 @@
|
|||
"hex": "48304502203b2fd1e39ae0e469d7a15768f262661b0de41470daf0fe8c4fd0c26542a0870002210081c57e331f9a2d214457d953e3542904727ee412c63028113635d7224da3dccc012103f1575d6124ac78be398c25b31146d08313c6072d23a4d7df5ac6a9f87346c64c"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "0bb57f6e38012c86d4c5a28c904f2675082859147921a707d48961015a3e5057",
|
||||
"vout": 1095,
|
||||
|
@ -165,7 +165,7 @@
|
|||
"hex": "48304502206947a9c54f0664ece4430fd4ae999891dc50bb6126bc36b6a15a3189f29d25e9022100a86cfc4e2fdd9e39a20e305cfd1b76509c67b3e313e0f118229105caa0e823c9012103f1575d6124ac78be398c25b31146d08313c6072d23a4d7df5ac6a9f87346c64c"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "9b34274814a2540bb062107117f8f3e75ef85d953e9372d8261a3e9dfbc1163f",
|
||||
"vout": 37,
|
||||
|
@ -174,7 +174,7 @@
|
|||
"hex": "483045022100c7128fe10b2d38744ae8177776054c29fc8ec13f07207723e70766ab7164847402201d2cf09009b9596de74c0183d1ab832e5edddb7a9965880bb400097e850850f8012103f1575d6124ac78be398c25b31146d08313c6072d23a4d7df5ac6a9f87346c64c"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "b86b5cc0d8a7374d94e277850b0a249cb26a7b42ddf014f28a49b8859da64241",
|
||||
"vout": 20,
|
||||
|
@ -183,7 +183,7 @@
|
|||
"hex": "48304502203b89a71628a28cc3703d170ca3be77786cff6b867e38a18b719705f8a326578f022100b2a9879e1acf621faa6466c207746a7f3eb4c8514c1482969aba3f2a957f1321012103f1575d6124ac78be398c25b31146d08313c6072d23a4d7df5ac6a9f87346c64c"
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "3d0a2353eeec44d3c10aed259038db321912122cd4150048f7bfa4c0ecfee236",
|
||||
"vout": 242,
|
||||
|
@ -207,7 +207,7 @@
|
|||
"DJFXow7CYcBWKVjwe1VH4or5f6YetLH1hw"
|
||||
]
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
"value": 0.01000001,
|
||||
"n": 1,
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
"hex": ""
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "bf829c6bcf84579331337659d31f89dfd138f7f7785802d5501c92333145ca7c",
|
||||
"vout": 18,
|
||||
|
@ -21,7 +21,7 @@
|
|||
"hex": ""
|
||||
},
|
||||
"sequence": 4294967295
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "22a6f904655d53ae2ff70e701a0bbd90aa3975c0f40bfc6cc996a9049e31cdfc",
|
||||
"vout": 1,
|
||||
|
@ -45,7 +45,7 @@
|
|||
"D82zqZA4KqaTPmsGegJ1ACoTXiSJ21NcZd"
|
||||
]
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
"value": 4.00,
|
||||
"n": 1,
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
"D82zqZA4KqaTPmsGegJ1ACoTXiSJ21NcZd"
|
||||
]
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
"value": 4.00,
|
||||
"n": 1,
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
"D82zqZA4KqaTPmsGegJ1ACoTXiSJ21NcZd"
|
||||
]
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
"value": 0.00,
|
||||
"n": 1,
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
"hex": ""
|
||||
},
|
||||
"sequence": 4294967293
|
||||
},
|
||||
},
|
||||
{
|
||||
"txid": "5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f",
|
||||
"vout": 0,
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
"reqSigs": 2,
|
||||
"type": "multisig",
|
||||
"addresses": [
|
||||
"DKwMZJ4jYfwAhJckKCMUFz2vrDqscXPMxB",
|
||||
"DKfzXQG7RiH3wE9tNJEKd3PK3UdgQshoTP",
|
||||
"DKwMZJ4jYfwAhJckKCMUFz2vrDqscXPMxB",
|
||||
"DKfzXQG7RiH3wE9tNJEKd3PK3UdgQshoTP",
|
||||
"D8V18BYptwTpq6eUidbj2AtkL396fFAR4Y"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
env:
|
||||
MAKEJOBS: "-j4"
|
||||
RUN_TESTS: "true"
|
||||
BASE_OUTDIR: "$CIRRUS_WORKING_DIR/out_dir_base"
|
||||
DEBIAN_FRONTEND: "noninteractive"
|
||||
|
||||
task:
|
||||
container:
|
||||
image: ubuntu:focal
|
||||
cpu: 1
|
||||
memory: 1G
|
||||
greedy: true # https://medium.com/cirruslabs/introducing-greedy-container-instances-29aad06dc2b4
|
||||
|
||||
matrix:
|
||||
- name: "gcc"
|
||||
env:
|
||||
CC: "gcc"
|
||||
CXX: "g++"
|
||||
APT_PKGS: "gcc"
|
||||
- name: "clang"
|
||||
env:
|
||||
CC: "clang"
|
||||
CXX: "clang++"
|
||||
APT_PKGS: "clang"
|
||||
- name: "mingw"
|
||||
env:
|
||||
CC: ""
|
||||
CXX: ""
|
||||
UNIVALUE_CONFIG: "--host=x86_64-w64-mingw32"
|
||||
APT_PKGS: "g++-mingw-w64-x86-64 gcc-mingw-w64-x86-64 binutils-mingw-w64-x86-64"
|
||||
RUN_TESTS: "false"
|
||||
|
||||
install_script:
|
||||
- apt update
|
||||
- apt install -y pkg-config build-essential libtool autotools-dev automake bsdmainutils
|
||||
- apt install -y $APT_PKGS
|
||||
autogen_script:
|
||||
- ./autogen.sh
|
||||
configure_script:
|
||||
- ./configure --cache-file=config.cache --bindir=$BASE_OUTDIR/bin --libdir=$BASE_OUTDIR/lib $UNIVALUE_CONFIG
|
||||
make_script:
|
||||
- make $MAKEJOBS V=1
|
||||
test_script:
|
||||
- if [ "$RUN_TESTS" = "true" ]; then make $MAKEJOBS distcheck; fi
|
|
@ -1,52 +0,0 @@
|
|||
language: cpp
|
||||
|
||||
compiler:
|
||||
- clang
|
||||
- gcc
|
||||
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
|
||||
sudo: false
|
||||
|
||||
env:
|
||||
global:
|
||||
- MAKEJOBS=-j3
|
||||
- RUN_TESTS=true
|
||||
- BASE_OUTDIR=$TRAVIS_BUILD_DIR/out
|
||||
|
||||
cache:
|
||||
apt: true
|
||||
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- pkg-config
|
||||
|
||||
before_script:
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew uninstall libtool; brew install libtool; fi
|
||||
- if [ -n "$USE_SHELL" ]; then export CONFIG_SHELL="$USE_SHELL"; fi
|
||||
- test -n "$USE_SHELL" && eval '"$USE_SHELL" -c "./autogen.sh"' || ./autogen.sh
|
||||
|
||||
script:
|
||||
- if [ -n "$UNIVALUE_CONFIG" ]; then unset CC; unset CXX; fi
|
||||
- OUTDIR=$BASE_OUTDIR/$TRAVIS_PULL_REQUEST/$TRAVIS_JOB_NUMBER-$HOST
|
||||
- UNIVALUE_CONFIG_ALL="--prefix=$TRAVIS_BUILD_DIR/depends/$HOST --bindir=$OUTDIR/bin --libdir=$OUTDIR/lib"
|
||||
- ./configure --cache-file=config.cache $UNIVALUE_CONFIG_ALL $UNIVALUE_CONFIG || ( cat config.log && false)
|
||||
- make -s $MAKEJOBS $GOAL || ( echo "Build failure. Verbose build follows." && make $GOAL ; false )
|
||||
- export LD_LIBRARY_PATH=$TRAVIS_BUILD_DIR/depends/$HOST/lib
|
||||
- if [ "$RUN_TESTS" = "true" ]; then make $MAKEJOBS distcheck; fi
|
||||
|
||||
matrix:
|
||||
fast_finish: true
|
||||
include:
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env: UNIVALUE_CONFIG=--host=x86_64-w64-mingw32 RUN_TESTS=false
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-mingw-w64-x86-64
|
||||
- gcc-mingw-w64-x86-64
|
||||
- binutils-mingw-w64-x86-64
|
|
@ -1,26 +1,24 @@
|
|||
include sources.mk
|
||||
ACLOCAL_AMFLAGS = -I build-aux/m4
|
||||
.PHONY: gen
|
||||
.PHONY: gen FORCE
|
||||
.INTERMEDIATE: $(GENBIN)
|
||||
|
||||
include_HEADERS = include/univalue.h
|
||||
noinst_HEADERS = lib/univalue_escapes.h lib/univalue_utffilter.h
|
||||
include_HEADERS = $(UNIVALUE_DIST_HEADERS_INT)
|
||||
noinst_HEADERS = $(UNIVALUE_LIB_HEADERS_INT)
|
||||
|
||||
lib_LTLIBRARIES = libunivalue.la
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = pc/libunivalue.pc
|
||||
|
||||
libunivalue_la_SOURCES = \
|
||||
lib/univalue.cpp \
|
||||
lib/univalue_read.cpp \
|
||||
lib/univalue_write.cpp
|
||||
libunivalue_la_SOURCES = $(UNIVALUE_LIB_SOURCES_INT)
|
||||
|
||||
libunivalue_la_LDFLAGS = \
|
||||
-version-info $(LIBUNIVALUE_CURRENT):$(LIBUNIVALUE_REVISION):$(LIBUNIVALUE_AGE) \
|
||||
-no-undefined
|
||||
libunivalue_la_CXXFLAGS = -I$(top_srcdir)/include
|
||||
|
||||
TESTS = test/unitester
|
||||
TESTS = test/object test/unitester test/no_nul
|
||||
|
||||
GENBIN = gen/gen$(BUILD_EXEEXT)
|
||||
GEN_SRCS = gen/gen.cpp
|
||||
|
@ -29,65 +27,32 @@ $(GENBIN): $(GEN_SRCS)
|
|||
@echo Building $@
|
||||
$(AM_V_at)c++ -I$(top_srcdir)/include -o $@ $<
|
||||
|
||||
gen: lib/univalue_escapes.h $(GENBIN)
|
||||
@echo Updating $<
|
||||
gen: $(GENBIN) FORCE
|
||||
@echo Updating lib/univalue_escapes.h
|
||||
$(AM_V_at)$(GENBIN) > lib/univalue_escapes.h
|
||||
|
||||
noinst_PROGRAMS = $(TESTS)
|
||||
noinst_PROGRAMS = $(TESTS) test/test_json
|
||||
|
||||
TEST_DATA_DIR=test
|
||||
|
||||
test_unitester_SOURCES = test/unitester.cpp
|
||||
test_unitester_SOURCES = $(UNIVALUE_TEST_UNITESTER_INT)
|
||||
test_unitester_LDADD = libunivalue.la
|
||||
test_unitester_CXXFLAGS = -I$(top_srcdir)/include -DJSON_TEST_SRC=\"$(srcdir)/$(TEST_DATA_DIR)\"
|
||||
test_unitester_CXXFLAGS = -I$(top_srcdir)/include -DJSON_TEST_SRC=\"$(srcdir)/$(UNIVALUE_TEST_DATA_DIR_INT)\"
|
||||
test_unitester_LDFLAGS = -static $(LIBTOOL_APP_LDFLAGS)
|
||||
|
||||
TEST_FILES = \
|
||||
$(TEST_DATA_DIR)/fail10.json \
|
||||
$(TEST_DATA_DIR)/fail11.json \
|
||||
$(TEST_DATA_DIR)/fail12.json \
|
||||
$(TEST_DATA_DIR)/fail13.json \
|
||||
$(TEST_DATA_DIR)/fail14.json \
|
||||
$(TEST_DATA_DIR)/fail15.json \
|
||||
$(TEST_DATA_DIR)/fail16.json \
|
||||
$(TEST_DATA_DIR)/fail17.json \
|
||||
$(TEST_DATA_DIR)/fail18.json \
|
||||
$(TEST_DATA_DIR)/fail19.json \
|
||||
$(TEST_DATA_DIR)/fail1.json \
|
||||
$(TEST_DATA_DIR)/fail20.json \
|
||||
$(TEST_DATA_DIR)/fail21.json \
|
||||
$(TEST_DATA_DIR)/fail22.json \
|
||||
$(TEST_DATA_DIR)/fail23.json \
|
||||
$(TEST_DATA_DIR)/fail24.json \
|
||||
$(TEST_DATA_DIR)/fail25.json \
|
||||
$(TEST_DATA_DIR)/fail26.json \
|
||||
$(TEST_DATA_DIR)/fail27.json \
|
||||
$(TEST_DATA_DIR)/fail28.json \
|
||||
$(TEST_DATA_DIR)/fail29.json \
|
||||
$(TEST_DATA_DIR)/fail2.json \
|
||||
$(TEST_DATA_DIR)/fail30.json \
|
||||
$(TEST_DATA_DIR)/fail31.json \
|
||||
$(TEST_DATA_DIR)/fail32.json \
|
||||
$(TEST_DATA_DIR)/fail33.json \
|
||||
$(TEST_DATA_DIR)/fail34.json \
|
||||
$(TEST_DATA_DIR)/fail35.json \
|
||||
$(TEST_DATA_DIR)/fail36.json \
|
||||
$(TEST_DATA_DIR)/fail37.json \
|
||||
$(TEST_DATA_DIR)/fail38.json \
|
||||
$(TEST_DATA_DIR)/fail39.json \
|
||||
$(TEST_DATA_DIR)/fail40.json \
|
||||
$(TEST_DATA_DIR)/fail41.json \
|
||||
$(TEST_DATA_DIR)/fail3.json \
|
||||
$(TEST_DATA_DIR)/fail4.json \
|
||||
$(TEST_DATA_DIR)/fail5.json \
|
||||
$(TEST_DATA_DIR)/fail6.json \
|
||||
$(TEST_DATA_DIR)/fail7.json \
|
||||
$(TEST_DATA_DIR)/fail8.json \
|
||||
$(TEST_DATA_DIR)/fail9.json \
|
||||
$(TEST_DATA_DIR)/pass1.json \
|
||||
$(TEST_DATA_DIR)/pass2.json \
|
||||
$(TEST_DATA_DIR)/pass3.json \
|
||||
$(TEST_DATA_DIR)/round1.json \
|
||||
$(TEST_DATA_DIR)/round2.json
|
||||
test_test_json_SOURCES = $(UNIVALUE_TEST_JSON_INT)
|
||||
test_test_json_LDADD = libunivalue.la
|
||||
test_test_json_CXXFLAGS = -I$(top_srcdir)/include
|
||||
test_test_json_LDFLAGS = -static $(LIBTOOL_APP_LDFLAGS)
|
||||
|
||||
EXTRA_DIST=$(TEST_FILES) $(GEN_SRCS)
|
||||
test_no_nul_SOURCES = $(UNIVALUE_TEST_NO_NUL_INT)
|
||||
test_no_nul_LDADD = libunivalue.la
|
||||
test_no_nul_CXXFLAGS = -I$(top_srcdir)/include
|
||||
test_no_nul_LDFLAGS = -static $(LIBTOOL_APP_LDFLAGS)
|
||||
|
||||
test_object_SOURCES = $(UNIVALUE_TEST_OBJECT_INT)
|
||||
test_object_LDADD = libunivalue.la
|
||||
test_object_CXXFLAGS = -I$(top_srcdir)/include
|
||||
test_object_LDFLAGS = -static $(LIBTOOL_APP_LDFLAGS)
|
||||
|
||||
TEST_FILES = $(UNIVALUE_TEST_FILES_INT)
|
||||
|
||||
EXTRA_DIST=$(UNIVALUE_TEST_FILES_INT) $(GEN_SRCS)
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
|
||||
UniValue
|
||||
|
||||
A universal value object, with JSON encoding (output) and decoding (input).
|
||||
|
||||
Built as a single dynamic RAII C++ object class, and no templates.
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
|
||||
# UniValue
|
||||
|
||||
## Summary
|
||||
|
||||
A universal value class, with JSON encoding and decoding.
|
||||
|
||||
UniValue is an abstract data type that may be a null, boolean, string,
|
||||
number, array container, or a key/value dictionary container, nested to
|
||||
an arbitrary depth.
|
||||
|
||||
This class is aligned with the JSON standard, [RFC
|
||||
7159](https://tools.ietf.org/html/rfc7159.html).
|
||||
|
||||
## Library usage
|
||||
|
||||
This is a fork of univalue used by Bitcoin Core. It is not maintained for usage
|
||||
by other projects. Notably, the API may break in non-backward-compatible ways.
|
||||
|
||||
Other projects looking for a maintained library should use the upstream
|
||||
univalue at https://github.com/jgarzik/univalue.
|
|
@ -0,0 +1,962 @@
|
|||
# ===========================================================================
|
||||
# https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Check for baseline language coverage in the compiler for the specified
|
||||
# version of the C++ standard. If necessary, add switches to CXX and
|
||||
# CXXCPP to enable support. VERSION may be '11' (for the C++11 standard)
|
||||
# or '14' (for the C++14 standard).
|
||||
#
|
||||
# The second argument, if specified, indicates whether you insist on an
|
||||
# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g.
|
||||
# -std=c++11). If neither is specified, you get whatever works, with
|
||||
# preference for no added switch, and then for an extended mode.
|
||||
#
|
||||
# The third argument, if specified 'mandatory' or if left unspecified,
|
||||
# indicates that baseline support for the specified C++ standard is
|
||||
# required and that the macro should error out if no mode with that
|
||||
# support is found. If specified 'optional', then configuration proceeds
|
||||
# regardless, after defining HAVE_CXX${VERSION} if and only if a
|
||||
# supporting mode is found.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
|
||||
# Copyright (c) 2012 Zack Weinberg <zackw@panix.com>
|
||||
# Copyright (c) 2013 Roy Stogner <roystgnr@ices.utexas.edu>
|
||||
# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov <sokolov@google.com>
|
||||
# Copyright (c) 2015 Paul Norman <penorman@mac.com>
|
||||
# Copyright (c) 2015 Moritz Klammler <moritz@klammler.eu>
|
||||
# Copyright (c) 2016, 2018 Krzesimir Nowak <qdlacz@gmail.com>
|
||||
# Copyright (c) 2019 Enji Cooper <yaneurabeya@gmail.com>
|
||||
# Copyright (c) 2020 Jason Merrill <jason@redhat.com>
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice
|
||||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 12
|
||||
|
||||
dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro
|
||||
dnl (serial version number 13).
|
||||
|
||||
AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
|
||||
m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"],
|
||||
[$1], [14], [ax_cxx_compile_alternatives="14 1y"],
|
||||
[$1], [17], [ax_cxx_compile_alternatives="17 1z"],
|
||||
[m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl
|
||||
m4_if([$2], [], [],
|
||||
[$2], [ext], [],
|
||||
[$2], [noext], [],
|
||||
[m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl
|
||||
m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true],
|
||||
[$3], [mandatory], [ax_cxx_compile_cxx$1_required=true],
|
||||
[$3], [optional], [ax_cxx_compile_cxx$1_required=false],
|
||||
[m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])])
|
||||
AC_LANG_PUSH([C++])dnl
|
||||
ac_success=no
|
||||
|
||||
m4_if([$2], [], [dnl
|
||||
AC_CACHE_CHECK(whether $CXX supports C++$1 features by default,
|
||||
ax_cv_cxx_compile_cxx$1,
|
||||
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
|
||||
[ax_cv_cxx_compile_cxx$1=yes],
|
||||
[ax_cv_cxx_compile_cxx$1=no])])
|
||||
if test x$ax_cv_cxx_compile_cxx$1 = xyes; then
|
||||
ac_success=yes
|
||||
fi])
|
||||
|
||||
m4_if([$2], [noext], [], [dnl
|
||||
if test x$ac_success = xno; then
|
||||
for alternative in ${ax_cxx_compile_alternatives}; do
|
||||
switch="-std=gnu++${alternative}"
|
||||
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
|
||||
AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch,
|
||||
$cachevar,
|
||||
[ac_save_CXX="$CXX"
|
||||
CXX="$CXX $switch"
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
|
||||
[eval $cachevar=yes],
|
||||
[eval $cachevar=no])
|
||||
CXX="$ac_save_CXX"])
|
||||
if eval test x\$$cachevar = xyes; then
|
||||
CXX="$CXX $switch"
|
||||
if test -n "$CXXCPP" ; then
|
||||
CXXCPP="$CXXCPP $switch"
|
||||
fi
|
||||
ac_success=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi])
|
||||
|
||||
m4_if([$2], [ext], [], [dnl
|
||||
if test x$ac_success = xno; then
|
||||
dnl HP's aCC needs +std=c++11 according to:
|
||||
dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf
|
||||
dnl Cray's crayCC needs "-h std=c++11"
|
||||
for alternative in ${ax_cxx_compile_alternatives}; do
|
||||
for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do
|
||||
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
|
||||
AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch,
|
||||
$cachevar,
|
||||
[ac_save_CXX="$CXX"
|
||||
CXX="$CXX $switch"
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
|
||||
[eval $cachevar=yes],
|
||||
[eval $cachevar=no])
|
||||
CXX="$ac_save_CXX"])
|
||||
if eval test x\$$cachevar = xyes; then
|
||||
CXX="$CXX $switch"
|
||||
if test -n "$CXXCPP" ; then
|
||||
CXXCPP="$CXXCPP $switch"
|
||||
fi
|
||||
ac_success=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test x$ac_success = xyes; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi])
|
||||
AC_LANG_POP([C++])
|
||||
if test x$ax_cxx_compile_cxx$1_required = xtrue; then
|
||||
if test x$ac_success = xno; then
|
||||
AC_MSG_ERROR([*** A compiler with support for C++$1 language features is required.])
|
||||
fi
|
||||
fi
|
||||
if test x$ac_success = xno; then
|
||||
HAVE_CXX$1=0
|
||||
AC_MSG_NOTICE([No compiler with C++$1 support was found])
|
||||
else
|
||||
HAVE_CXX$1=1
|
||||
AC_DEFINE(HAVE_CXX$1,1,
|
||||
[define if the compiler supports basic C++$1 syntax])
|
||||
fi
|
||||
AC_SUBST(HAVE_CXX$1)
|
||||
])
|
||||
|
||||
|
||||
dnl Test body for checking C++11 support
|
||||
|
||||
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11],
|
||||
_AX_CXX_COMPILE_STDCXX_testbody_new_in_11
|
||||
)
|
||||
|
||||
|
||||
dnl Test body for checking C++14 support
|
||||
|
||||
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14],
|
||||
_AX_CXX_COMPILE_STDCXX_testbody_new_in_11
|
||||
_AX_CXX_COMPILE_STDCXX_testbody_new_in_14
|
||||
)
|
||||
|
||||
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_17],
|
||||
_AX_CXX_COMPILE_STDCXX_testbody_new_in_11
|
||||
_AX_CXX_COMPILE_STDCXX_testbody_new_in_14
|
||||
_AX_CXX_COMPILE_STDCXX_testbody_new_in_17
|
||||
)
|
||||
|
||||
dnl Tests for new features in C++11
|
||||
|
||||
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[
|
||||
|
||||
// If the compiler admits that it is not ready for C++11, why torture it?
|
||||
// Hopefully, this will speed up the test.
|
||||
|
||||
#ifndef __cplusplus
|
||||
|
||||
#error "This is not a C++ compiler"
|
||||
|
||||
#elif __cplusplus < 201103L
|
||||
|
||||
#error "This is not a C++11 compiler"
|
||||
|
||||
#else
|
||||
|
||||
namespace cxx11
|
||||
{
|
||||
|
||||
namespace test_static_assert
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
struct check
|
||||
{
|
||||
static_assert(sizeof(int) <= sizeof(T), "not big enough");
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
namespace test_final_override
|
||||
{
|
||||
|
||||
struct Base
|
||||
{
|
||||
virtual ~Base() {}
|
||||
virtual void f() {}
|
||||
};
|
||||
|
||||
struct Derived : public Base
|
||||
{
|
||||
virtual ~Derived() override {}
|
||||
virtual void f() override {}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
namespace test_double_right_angle_brackets
|
||||
{
|
||||
|
||||
template < typename T >
|
||||
struct check {};
|
||||
|
||||
typedef check<void> single_type;
|
||||
typedef check<check<void>> double_type;
|
||||
typedef check<check<check<void>>> triple_type;
|
||||
typedef check<check<check<check<void>>>> quadruple_type;
|
||||
|
||||
}
|
||||
|
||||
namespace test_decltype
|
||||
{
|
||||
|
||||
int
|
||||
f()
|
||||
{
|
||||
int a = 1;
|
||||
decltype(a) b = 2;
|
||||
return a + b;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_type_deduction
|
||||
{
|
||||
|
||||
template < typename T1, typename T2 >
|
||||
struct is_same
|
||||
{
|
||||
static const bool value = false;
|
||||
};
|
||||
|
||||
template < typename T >
|
||||
struct is_same<T, T>
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
template < typename T1, typename T2 >
|
||||
auto
|
||||
add(T1 a1, T2 a2) -> decltype(a1 + a2)
|
||||
{
|
||||
return a1 + a2;
|
||||
}
|
||||
|
||||
int
|
||||
test(const int c, volatile int v)
|
||||
{
|
||||
static_assert(is_same<int, decltype(0)>::value == true, "");
|
||||
static_assert(is_same<int, decltype(c)>::value == false, "");
|
||||
static_assert(is_same<int, decltype(v)>::value == false, "");
|
||||
auto ac = c;
|
||||
auto av = v;
|
||||
auto sumi = ac + av + 'x';
|
||||
auto sumf = ac + av + 1.0;
|
||||
static_assert(is_same<int, decltype(ac)>::value == true, "");
|
||||
static_assert(is_same<int, decltype(av)>::value == true, "");
|
||||
static_assert(is_same<int, decltype(sumi)>::value == true, "");
|
||||
static_assert(is_same<int, decltype(sumf)>::value == false, "");
|
||||
static_assert(is_same<int, decltype(add(c, v))>::value == true, "");
|
||||
return (sumf > 0.0) ? sumi : add(c, v);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_noexcept
|
||||
{
|
||||
|
||||
int f() { return 0; }
|
||||
int g() noexcept { return 0; }
|
||||
|
||||
static_assert(noexcept(f()) == false, "");
|
||||
static_assert(noexcept(g()) == true, "");
|
||||
|
||||
}
|
||||
|
||||
namespace test_constexpr
|
||||
{
|
||||
|
||||
template < typename CharT >
|
||||
unsigned long constexpr
|
||||
strlen_c_r(const CharT *const s, const unsigned long acc) noexcept
|
||||
{
|
||||
return *s ? strlen_c_r(s + 1, acc + 1) : acc;
|
||||
}
|
||||
|
||||
template < typename CharT >
|
||||
unsigned long constexpr
|
||||
strlen_c(const CharT *const s) noexcept
|
||||
{
|
||||
return strlen_c_r(s, 0UL);
|
||||
}
|
||||
|
||||
static_assert(strlen_c("") == 0UL, "");
|
||||
static_assert(strlen_c("1") == 1UL, "");
|
||||
static_assert(strlen_c("example") == 7UL, "");
|
||||
static_assert(strlen_c("another\0example") == 7UL, "");
|
||||
|
||||
}
|
||||
|
||||
namespace test_rvalue_references
|
||||
{
|
||||
|
||||
template < int N >
|
||||
struct answer
|
||||
{
|
||||
static constexpr int value = N;
|
||||
};
|
||||
|
||||
answer<1> f(int&) { return answer<1>(); }
|
||||
answer<2> f(const int&) { return answer<2>(); }
|
||||
answer<3> f(int&&) { return answer<3>(); }
|
||||
|
||||
void
|
||||
test()
|
||||
{
|
||||
int i = 0;
|
||||
const int c = 0;
|
||||
static_assert(decltype(f(i))::value == 1, "");
|
||||
static_assert(decltype(f(c))::value == 2, "");
|
||||
static_assert(decltype(f(0))::value == 3, "");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_uniform_initialization
|
||||
{
|
||||
|
||||
struct test
|
||||
{
|
||||
static const int zero {};
|
||||
static const int one {1};
|
||||
};
|
||||
|
||||
static_assert(test::zero == 0, "");
|
||||
static_assert(test::one == 1, "");
|
||||
|
||||
}
|
||||
|
||||
namespace test_lambdas
|
||||
{
|
||||
|
||||
void
|
||||
test1()
|
||||
{
|
||||
auto lambda1 = [](){};
|
||||
auto lambda2 = lambda1;
|
||||
lambda1();
|
||||
lambda2();
|
||||
}
|
||||
|
||||
int
|
||||
test2()
|
||||
{
|
||||
auto a = [](int i, int j){ return i + j; }(1, 2);
|
||||
auto b = []() -> int { return '0'; }();
|
||||
auto c = [=](){ return a + b; }();
|
||||
auto d = [&](){ return c; }();
|
||||
auto e = [a, &b](int x) mutable {
|
||||
const auto identity = [](int y){ return y; };
|
||||
for (auto i = 0; i < a; ++i)
|
||||
a += b--;
|
||||
return x + identity(a + b);
|
||||
}(0);
|
||||
return a + b + c + d + e;
|
||||
}
|
||||
|
||||
int
|
||||
test3()
|
||||
{
|
||||
const auto nullary = [](){ return 0; };
|
||||
const auto unary = [](int x){ return x; };
|
||||
using nullary_t = decltype(nullary);
|
||||
using unary_t = decltype(unary);
|
||||
const auto higher1st = [](nullary_t f){ return f(); };
|
||||
const auto higher2nd = [unary](nullary_t f1){
|
||||
return [unary, f1](unary_t f2){ return f2(unary(f1())); };
|
||||
};
|
||||
return higher1st(nullary) + higher2nd(nullary)(unary);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_variadic_templates
|
||||
{
|
||||
|
||||
template <int...>
|
||||
struct sum;
|
||||
|
||||
template <int N0, int... N1toN>
|
||||
struct sum<N0, N1toN...>
|
||||
{
|
||||
static constexpr auto value = N0 + sum<N1toN...>::value;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct sum<>
|
||||
{
|
||||
static constexpr auto value = 0;
|
||||
};
|
||||
|
||||
static_assert(sum<>::value == 0, "");
|
||||
static_assert(sum<1>::value == 1, "");
|
||||
static_assert(sum<23>::value == 23, "");
|
||||
static_assert(sum<1, 2>::value == 3, "");
|
||||
static_assert(sum<5, 5, 11>::value == 21, "");
|
||||
static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, "");
|
||||
|
||||
}
|
||||
|
||||
// http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae
|
||||
// Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function
|
||||
// because of this.
|
||||
namespace test_template_alias_sfinae
|
||||
{
|
||||
|
||||
struct foo {};
|
||||
|
||||
template<typename T>
|
||||
using member = typename T::member_type;
|
||||
|
||||
template<typename T>
|
||||
void func(...) {}
|
||||
|
||||
template<typename T>
|
||||
void func(member<T>*) {}
|
||||
|
||||
void test();
|
||||
|
||||
void test() { func<foo>(0); }
|
||||
|
||||
}
|
||||
|
||||
} // namespace cxx11
|
||||
|
||||
#endif // __cplusplus >= 201103L
|
||||
|
||||
]])
|
||||
|
||||
|
||||
dnl Tests for new features in C++14
|
||||
|
||||
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[
|
||||
|
||||
// If the compiler admits that it is not ready for C++14, why torture it?
|
||||
// Hopefully, this will speed up the test.
|
||||
|
||||
#ifndef __cplusplus
|
||||
|
||||
#error "This is not a C++ compiler"
|
||||
|
||||
#elif __cplusplus < 201402L
|
||||
|
||||
#error "This is not a C++14 compiler"
|
||||
|
||||
#else
|
||||
|
||||
namespace cxx14
|
||||
{
|
||||
|
||||
namespace test_polymorphic_lambdas
|
||||
{
|
||||
|
||||
int
|
||||
test()
|
||||
{
|
||||
const auto lambda = [](auto&&... args){
|
||||
const auto istiny = [](auto x){
|
||||
return (sizeof(x) == 1UL) ? 1 : 0;
|
||||
};
|
||||
const int aretiny[] = { istiny(args)... };
|
||||
return aretiny[0];
|
||||
};
|
||||
return lambda(1, 1L, 1.0f, '1');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_binary_literals
|
||||
{
|
||||
|
||||
constexpr auto ivii = 0b0000000000101010;
|
||||
static_assert(ivii == 42, "wrong value");
|
||||
|
||||
}
|
||||
|
||||
namespace test_generalized_constexpr
|
||||
{
|
||||
|
||||
template < typename CharT >
|
||||
constexpr unsigned long
|
||||
strlen_c(const CharT *const s) noexcept
|
||||
{
|
||||
auto length = 0UL;
|
||||
for (auto p = s; *p; ++p)
|
||||
++length;
|
||||
return length;
|
||||
}
|
||||
|
||||
static_assert(strlen_c("") == 0UL, "");
|
||||
static_assert(strlen_c("x") == 1UL, "");
|
||||
static_assert(strlen_c("test") == 4UL, "");
|
||||
static_assert(strlen_c("another\0test") == 7UL, "");
|
||||
|
||||
}
|
||||
|
||||
namespace test_lambda_init_capture
|
||||
{
|
||||
|
||||
int
|
||||
test()
|
||||
{
|
||||
auto x = 0;
|
||||
const auto lambda1 = [a = x](int b){ return a + b; };
|
||||
const auto lambda2 = [a = lambda1(x)](){ return a; };
|
||||
return lambda2();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_digit_separators
|
||||
{
|
||||
|
||||
constexpr auto ten_million = 100'000'000;
|
||||
static_assert(ten_million == 100000000, "");
|
||||
|
||||
}
|
||||
|
||||
namespace test_return_type_deduction
|
||||
{
|
||||
|
||||
auto f(int& x) { return x; }
|
||||
decltype(auto) g(int& x) { return x; }
|
||||
|
||||
template < typename T1, typename T2 >
|
||||
struct is_same
|
||||
{
|
||||
static constexpr auto value = false;
|
||||
};
|
||||
|
||||
template < typename T >
|
||||
struct is_same<T, T>
|
||||
{
|
||||
static constexpr auto value = true;
|
||||
};
|
||||
|
||||
int
|
||||
test()
|
||||
{
|
||||
auto x = 0;
|
||||
static_assert(is_same<int, decltype(f(x))>::value, "");
|
||||
static_assert(is_same<int&, decltype(g(x))>::value, "");
|
||||
return x;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} // namespace cxx14
|
||||
|
||||
#endif // __cplusplus >= 201402L
|
||||
|
||||
]])
|
||||
|
||||
|
||||
dnl Tests for new features in C++17
|
||||
|
||||
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[
|
||||
|
||||
// If the compiler admits that it is not ready for C++17, why torture it?
|
||||
// Hopefully, this will speed up the test.
|
||||
|
||||
#ifndef __cplusplus
|
||||
|
||||
#error "This is not a C++ compiler"
|
||||
|
||||
#elif __cplusplus < 201703L
|
||||
|
||||
#error "This is not a C++17 compiler"
|
||||
|
||||
#else
|
||||
|
||||
#include <initializer_list>
|
||||
#include <utility>
|
||||
#include <type_traits>
|
||||
|
||||
namespace cxx17
|
||||
{
|
||||
|
||||
namespace test_constexpr_lambdas
|
||||
{
|
||||
|
||||
constexpr int foo = [](){return 42;}();
|
||||
|
||||
}
|
||||
|
||||
namespace test::nested_namespace::definitions
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
namespace test_fold_expression
|
||||
{
|
||||
|
||||
template<typename... Args>
|
||||
int multiply(Args... args)
|
||||
{
|
||||
return (args * ... * 1);
|
||||
}
|
||||
|
||||
template<typename... Args>
|
||||
bool all(Args... args)
|
||||
{
|
||||
return (args && ...);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_extended_static_assert
|
||||
{
|
||||
|
||||
static_assert (true);
|
||||
|
||||
}
|
||||
|
||||
namespace test_auto_brace_init_list
|
||||
{
|
||||
|
||||
auto foo = {5};
|
||||
auto bar {5};
|
||||
|
||||
static_assert(std::is_same<std::initializer_list<int>, decltype(foo)>::value);
|
||||
static_assert(std::is_same<int, decltype(bar)>::value);
|
||||
}
|
||||
|
||||
namespace test_typename_in_template_template_parameter
|
||||
{
|
||||
|
||||
template<template<typename> typename X> struct D;
|
||||
|
||||
}
|
||||
|
||||
namespace test_fallthrough_nodiscard_maybe_unused_attributes
|
||||
{
|
||||
|
||||
int f1()
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
|
||||
[[nodiscard]] int f2()
|
||||
{
|
||||
[[maybe_unused]] auto unused = f1();
|
||||
|
||||
switch (f1())
|
||||
{
|
||||
case 17:
|
||||
f1();
|
||||
[[fallthrough]];
|
||||
case 42:
|
||||
f1();
|
||||
}
|
||||
return f1();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_extended_aggregate_initialization
|
||||
{
|
||||
|
||||
struct base1
|
||||
{
|
||||
int b1, b2 = 42;
|
||||
};
|
||||
|
||||
struct base2
|
||||
{
|
||||
base2() {
|
||||
b3 = 42;
|
||||
}
|
||||
int b3;
|
||||
};
|
||||
|
||||
struct derived : base1, base2
|
||||
{
|
||||
int d;
|
||||
};
|
||||
|
||||
derived d1 {{1, 2}, {}, 4}; // full initialization
|
||||
derived d2 {{}, {}, 4}; // value-initialized bases
|
||||
|
||||
}
|
||||
|
||||
namespace test_general_range_based_for_loop
|
||||
{
|
||||
|
||||
struct iter
|
||||
{
|
||||
int i;
|
||||
|
||||
int& operator* ()
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
const int& operator* () const
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
iter& operator++()
|
||||
{
|
||||
++i;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
struct sentinel
|
||||
{
|
||||
int i;
|
||||
};
|
||||
|
||||
bool operator== (const iter& i, const sentinel& s)
|
||||
{
|
||||
return i.i == s.i;
|
||||
}
|
||||
|
||||
bool operator!= (const iter& i, const sentinel& s)
|
||||
{
|
||||
return !(i == s);
|
||||
}
|
||||
|
||||
struct range
|
||||
{
|
||||
iter begin() const
|
||||
{
|
||||
return {0};
|
||||
}
|
||||
|
||||
sentinel end() const
|
||||
{
|
||||
return {5};
|
||||
}
|
||||
};
|
||||
|
||||
void f()
|
||||
{
|
||||
range r {};
|
||||
|
||||
for (auto i : r)
|
||||
{
|
||||
[[maybe_unused]] auto v = i;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_lambda_capture_asterisk_this_by_value
|
||||
{
|
||||
|
||||
struct t
|
||||
{
|
||||
int i;
|
||||
int foo()
|
||||
{
|
||||
return [*this]()
|
||||
{
|
||||
return i;
|
||||
}();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
namespace test_enum_class_construction
|
||||
{
|
||||
|
||||
enum class byte : unsigned char
|
||||
{};
|
||||
|
||||
byte foo {42};
|
||||
|
||||
}
|
||||
|
||||
namespace test_constexpr_if
|
||||
{
|
||||
|
||||
template <bool cond>
|
||||
int f ()
|
||||
{
|
||||
if constexpr(cond)
|
||||
{
|
||||
return 13;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_selection_statement_with_initializer
|
||||
{
|
||||
|
||||
int f()
|
||||
{
|
||||
return 13;
|
||||
}
|
||||
|
||||
int f2()
|
||||
{
|
||||
if (auto i = f(); i > 0)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
switch (auto i = f(); i + 4)
|
||||
{
|
||||
case 17:
|
||||
return 2;
|
||||
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_template_argument_deduction_for_class_templates
|
||||
{
|
||||
|
||||
template <typename T1, typename T2>
|
||||
struct pair
|
||||
{
|
||||
pair (T1 p1, T2 p2)
|
||||
: m1 {p1},
|
||||
m2 {p2}
|
||||
{}
|
||||
|
||||
T1 m1;
|
||||
T2 m2;
|
||||
};
|
||||
|
||||
void f()
|
||||
{
|
||||
[[maybe_unused]] auto p = pair{13, 42u};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_non_type_auto_template_parameters
|
||||
{
|
||||
|
||||
template <auto n>
|
||||
struct B
|
||||
{};
|
||||
|
||||
B<5> b1;
|
||||
B<'a'> b2;
|
||||
|
||||
}
|
||||
|
||||
namespace test_structured_bindings
|
||||
{
|
||||
|
||||
int arr[2] = { 1, 2 };
|
||||
std::pair<int, int> pr = { 1, 2 };
|
||||
|
||||
auto f1() -> int(&)[2]
|
||||
{
|
||||
return arr;
|
||||
}
|
||||
|
||||
auto f2() -> std::pair<int, int>&
|
||||
{
|
||||
return pr;
|
||||
}
|
||||
|
||||
struct S
|
||||
{
|
||||
int x1 : 2;
|
||||
volatile double y1;
|
||||
};
|
||||
|
||||
S f3()
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
auto [ x1, y1 ] = f1();
|
||||
auto& [ xr1, yr1 ] = f1();
|
||||
auto [ x2, y2 ] = f2();
|
||||
auto& [ xr2, yr2 ] = f2();
|
||||
const auto [ x3, y3 ] = f3();
|
||||
|
||||
}
|
||||
|
||||
namespace test_exception_spec_type_system
|
||||
{
|
||||
|
||||
struct Good {};
|
||||
struct Bad {};
|
||||
|
||||
void g1() noexcept;
|
||||
void g2();
|
||||
|
||||
template<typename T>
|
||||
Bad
|
||||
f(T*, T*);
|
||||
|
||||
template<typename T1, typename T2>
|
||||
Good
|
||||
f(T1*, T2*);
|
||||
|
||||
static_assert (std::is_same_v<Good, decltype(f(g1, g2))>);
|
||||
|
||||
}
|
||||
|
||||
namespace test_inline_variables
|
||||
{
|
||||
|
||||
template<class T> void f(T)
|
||||
{}
|
||||
|
||||
template<class T> inline T g(T)
|
||||
{
|
||||
return T{};
|
||||
}
|
||||
|
||||
template<> inline void f<>(int)
|
||||
{}
|
||||
|
||||
template<> int g<>(int)
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} // namespace cxx17
|
||||
|
||||
#endif // __cplusplus < 201703L
|
||||
|
||||
]])
|
|
@ -1,7 +1,7 @@
|
|||
m4_define([libunivalue_major_version], [1])
|
||||
m4_define([libunivalue_minor_version], [1])
|
||||
m4_define([libunivalue_micro_version], [2])
|
||||
m4_define([libunivalue_interface_age], [2])
|
||||
m4_define([libunivalue_micro_version], [4])
|
||||
m4_define([libunivalue_interface_age], [4])
|
||||
# If you need a modifier for the version number.
|
||||
# Normally empty, but can be used to make "fixup" releases.
|
||||
m4_define([libunivalue_extraversion], [])
|
||||
|
@ -14,7 +14,7 @@ m4_define([libunivalue_age], [m4_eval(libunivalue_binary_age - libunivalue_inter
|
|||
m4_define([libunivalue_version], [libunivalue_major_version().libunivalue_minor_version().libunivalue_micro_version()libunivalue_extraversion()])
|
||||
|
||||
|
||||
AC_INIT([univalue], [1.0.2],
|
||||
AC_INIT([univalue], [1.0.4],
|
||||
[http://github.com/jgarzik/univalue/])
|
||||
|
||||
dnl make the compilation flags quiet unless V=1 is used
|
||||
|
@ -45,6 +45,9 @@ AC_SUBST(LIBUNIVALUE_AGE)
|
|||
LT_INIT
|
||||
LT_LANG([C++])
|
||||
|
||||
dnl Require C++11 compiler (no GNU extensions)
|
||||
AX_CXX_COMPILE_STDCXX([11], [noext], [mandatory], [nodefault])
|
||||
|
||||
case $host in
|
||||
*mingw*)
|
||||
LIBTOOL_APP_LDFLAGS="$LIBTOOL_APP_LDFLAGS -all-static"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright 2014 BitPay Inc.
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
// file COPYING or https://opensource.org/licenses/mit-license.php.
|
||||
|
||||
//
|
||||
// To re-create univalue_escapes.h:
|
||||
|
@ -12,8 +12,6 @@
|
|||
#include <string.h>
|
||||
#include "univalue.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
static bool initEscapes;
|
||||
static std::string escapes[256];
|
||||
|
||||
|
@ -47,7 +45,7 @@ static void outputEscape()
|
|||
|
||||
for (unsigned int i = 0; i < 256; i++) {
|
||||
if (escapes[i].empty()) {
|
||||
printf("\tNULL,\n");
|
||||
printf("\tnullptr,\n");
|
||||
} else {
|
||||
printf("\t\"");
|
||||
|
||||
|
|
|
@ -1,21 +1,19 @@
|
|||
// Copyright 2014 BitPay Inc.
|
||||
// Copyright 2015 Bitcoin Core Developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
// file COPYING or https://opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef __UNIVALUE_H__
|
||||
#define __UNIVALUE_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <cassert>
|
||||
|
||||
#include <sstream> // .get_int64()
|
||||
#include <utility> // std::pair
|
||||
|
||||
class UniValue {
|
||||
public:
|
||||
enum VType { VNULL, VOBJ, VARR, VSTR, VNUM, VBOOL, };
|
||||
|
@ -47,7 +45,6 @@ public:
|
|||
std::string s(val_);
|
||||
setStr(s);
|
||||
}
|
||||
~UniValue() {}
|
||||
|
||||
void clear();
|
||||
|
||||
|
@ -69,10 +66,11 @@ public:
|
|||
size_t size() const { return values.size(); }
|
||||
|
||||
bool getBool() const { return isTrue(); }
|
||||
bool checkObject(const std::map<std::string,UniValue::VType>& memberTypes);
|
||||
void getObjMap(std::map<std::string,UniValue>& kv) const;
|
||||
bool checkObject(const std::map<std::string,UniValue::VType>& memberTypes) const;
|
||||
const UniValue& operator[](const std::string& key) const;
|
||||
const UniValue& operator[](unsigned int index) const;
|
||||
bool exists(const std::string& key) const { return (findKey(key) >= 0); }
|
||||
const UniValue& operator[](size_t index) const;
|
||||
bool exists(const std::string& key) const { size_t i; return findKey(key, i); }
|
||||
|
||||
bool isNull() const { return (typ == VNULL); }
|
||||
bool isTrue() const { return (typ == VBOOL) && (val == "1"); }
|
||||
|
@ -92,8 +90,29 @@ public:
|
|||
std::string s(val_);
|
||||
return push_back(s);
|
||||
}
|
||||
bool push_back(uint64_t val_) {
|
||||
UniValue tmpVal(val_);
|
||||
return push_back(tmpVal);
|
||||
}
|
||||
bool push_back(int64_t val_) {
|
||||
UniValue tmpVal(val_);
|
||||
return push_back(tmpVal);
|
||||
}
|
||||
bool push_back(bool val_) {
|
||||
UniValue tmpVal(val_);
|
||||
return push_back(tmpVal);
|
||||
}
|
||||
bool push_back(int val_) {
|
||||
UniValue tmpVal(val_);
|
||||
return push_back(tmpVal);
|
||||
}
|
||||
bool push_back(double val_) {
|
||||
UniValue tmpVal(val_);
|
||||
return push_back(tmpVal);
|
||||
}
|
||||
bool push_backV(const std::vector<UniValue>& vec);
|
||||
|
||||
void __pushKV(const std::string& key, const UniValue& val);
|
||||
bool pushKV(const std::string& key, const UniValue& val);
|
||||
bool pushKV(const std::string& key, const std::string& val_) {
|
||||
UniValue tmpVal(VSTR, val_);
|
||||
|
@ -111,6 +130,10 @@ public:
|
|||
UniValue tmpVal(val_);
|
||||
return pushKV(key, tmpVal);
|
||||
}
|
||||
bool pushKV(const std::string& key, bool val_) {
|
||||
UniValue tmpVal(val_);
|
||||
return pushKV(key, tmpVal);
|
||||
}
|
||||
bool pushKV(const std::string& key, int val_) {
|
||||
UniValue tmpVal((int64_t)val_);
|
||||
return pushKV(key, tmpVal);
|
||||
|
@ -124,9 +147,10 @@ public:
|
|||
std::string write(unsigned int prettyIndent = 0,
|
||||
unsigned int indentLevel = 0) const;
|
||||
|
||||
bool read(const char *raw);
|
||||
bool read(const char *raw, size_t len);
|
||||
bool read(const char *raw) { return read(raw, strlen(raw)); }
|
||||
bool read(const std::string& rawStr) {
|
||||
return read(rawStr.c_str());
|
||||
return read(rawStr.data(), rawStr.size());
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -135,7 +159,7 @@ private:
|
|||
std::vector<std::string> keys;
|
||||
std::vector<UniValue> values;
|
||||
|
||||
int findKey(const std::string& key) const;
|
||||
bool findKey(const std::string& key, size_t& retIdx) const;
|
||||
void writeArray(unsigned int prettyIndent, unsigned int indentLevel, std::string& s) const;
|
||||
void writeObject(unsigned int prettyIndent, unsigned int indentLevel, std::string& s) const;
|
||||
|
||||
|
@ -153,76 +177,9 @@ public:
|
|||
const UniValue& get_array() const;
|
||||
|
||||
enum VType type() const { return getType(); }
|
||||
bool push_back(std::pair<std::string,UniValue> pear) {
|
||||
return pushKV(pear.first, pear.second);
|
||||
}
|
||||
friend const UniValue& find_value( const UniValue& obj, const std::string& name);
|
||||
};
|
||||
|
||||
//
|
||||
// The following were added for compatibility with json_spirit.
|
||||
// Most duplicate other methods, and should be removed.
|
||||
//
|
||||
static inline std::pair<std::string,UniValue> Pair(const char *cKey, const char *cVal)
|
||||
{
|
||||
std::string key(cKey);
|
||||
UniValue uVal(cVal);
|
||||
return std::make_pair(key, uVal);
|
||||
}
|
||||
|
||||
static inline std::pair<std::string,UniValue> Pair(const char *cKey, std::string strVal)
|
||||
{
|
||||
std::string key(cKey);
|
||||
UniValue uVal(strVal);
|
||||
return std::make_pair(key, uVal);
|
||||
}
|
||||
|
||||
static inline std::pair<std::string,UniValue> Pair(const char *cKey, uint64_t u64Val)
|
||||
{
|
||||
std::string key(cKey);
|
||||
UniValue uVal(u64Val);
|
||||
return std::make_pair(key, uVal);
|
||||
}
|
||||
|
||||
static inline std::pair<std::string,UniValue> Pair(const char *cKey, int64_t i64Val)
|
||||
{
|
||||
std::string key(cKey);
|
||||
UniValue uVal(i64Val);
|
||||
return std::make_pair(key, uVal);
|
||||
}
|
||||
|
||||
static inline std::pair<std::string,UniValue> Pair(const char *cKey, bool iVal)
|
||||
{
|
||||
std::string key(cKey);
|
||||
UniValue uVal(iVal);
|
||||
return std::make_pair(key, uVal);
|
||||
}
|
||||
|
||||
static inline std::pair<std::string,UniValue> Pair(const char *cKey, int iVal)
|
||||
{
|
||||
std::string key(cKey);
|
||||
UniValue uVal(iVal);
|
||||
return std::make_pair(key, uVal);
|
||||
}
|
||||
|
||||
static inline std::pair<std::string,UniValue> Pair(const char *cKey, double dVal)
|
||||
{
|
||||
std::string key(cKey);
|
||||
UniValue uVal(dVal);
|
||||
return std::make_pair(key, uVal);
|
||||
}
|
||||
|
||||
static inline std::pair<std::string,UniValue> Pair(const char *cKey, const UniValue& uVal)
|
||||
{
|
||||
std::string key(cKey);
|
||||
return std::make_pair(key, uVal);
|
||||
}
|
||||
|
||||
static inline std::pair<std::string,UniValue> Pair(std::string key, const UniValue& uVal)
|
||||
{
|
||||
return std::make_pair(key, uVal);
|
||||
}
|
||||
|
||||
enum jtokentype {
|
||||
JTOK_ERR = -1,
|
||||
JTOK_NONE = 0, // eof
|
||||
|
@ -240,7 +197,7 @@ enum jtokentype {
|
|||
};
|
||||
|
||||
extern enum jtokentype getJsonToken(std::string& tokenVal,
|
||||
unsigned int& consumed, const char *raw);
|
||||
unsigned int& consumed, const char *raw, const char *end);
|
||||
extern const char *uvTypeName(UniValue::VType t);
|
||||
|
||||
static inline bool jsonTokenIsValue(enum jtokentype jtt)
|
||||
|
|
|
@ -1,80 +1,15 @@
|
|||
// Copyright 2014 BitPay Inc.
|
||||
// Copyright 2015 Bitcoin Core Developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
// file COPYING or https://opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
#include <iomanip>
|
||||
#include <limits>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "univalue.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
static bool ParsePrechecks(const std::string& str)
|
||||
{
|
||||
if (str.empty()) // No empty string allowed
|
||||
return false;
|
||||
if (str.size() >= 1 && (json_isspace(str[0]) || json_isspace(str[str.size()-1]))) // No padding allowed
|
||||
return false;
|
||||
if (str.size() != strlen(str.c_str())) // No embedded NUL characters allowed
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ParseInt32(const std::string& str, int32_t *out)
|
||||
{
|
||||
if (!ParsePrechecks(str))
|
||||
return false;
|
||||
char *endp = NULL;
|
||||
errno = 0; // strtol will not set errno if valid
|
||||
long int n = strtol(str.c_str(), &endp, 10);
|
||||
if(out) *out = (int32_t)n;
|
||||
// Note that strtol returns a *long int*, so even if strtol doesn't report a over/underflow
|
||||
// we still have to check that the returned value is within the range of an *int32_t*. On 64-bit
|
||||
// platforms the size of these types may be different.
|
||||
return endp && *endp == 0 && !errno &&
|
||||
n >= std::numeric_limits<int32_t>::min() &&
|
||||
n <= std::numeric_limits<int32_t>::max();
|
||||
}
|
||||
|
||||
bool ParseInt64(const std::string& str, int64_t *out)
|
||||
{
|
||||
if (!ParsePrechecks(str))
|
||||
return false;
|
||||
char *endp = NULL;
|
||||
errno = 0; // strtoll will not set errno if valid
|
||||
long long int n = strtoll(str.c_str(), &endp, 10);
|
||||
if(out) *out = (int64_t)n;
|
||||
// Note that strtoll returns a *long long int*, so even if strtol doesn't report a over/underflow
|
||||
// we still have to check that the returned value is within the range of an *int64_t*.
|
||||
return endp && *endp == 0 && !errno &&
|
||||
n >= std::numeric_limits<int64_t>::min() &&
|
||||
n <= std::numeric_limits<int64_t>::max();
|
||||
}
|
||||
|
||||
bool ParseDouble(const std::string& str, double *out)
|
||||
{
|
||||
if (!ParsePrechecks(str))
|
||||
return false;
|
||||
if (str.size() >= 2 && str[0] == '0' && str[1] == 'x') // No hexadecimal floats allowed
|
||||
return false;
|
||||
std::istringstream text(str);
|
||||
text.imbue(std::locale::classic());
|
||||
double result;
|
||||
text >> result;
|
||||
if(out) *out = result;
|
||||
return text.eof() && !text.fail();
|
||||
}
|
||||
}
|
||||
|
||||
using namespace std;
|
||||
|
||||
const UniValue NullUniValue;
|
||||
|
||||
void UniValue::clear()
|
||||
|
@ -100,15 +35,15 @@ bool UniValue::setBool(bool val_)
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool validNumStr(const string& s)
|
||||
static bool validNumStr(const std::string& s)
|
||||
{
|
||||
string tokenVal;
|
||||
std::string tokenVal;
|
||||
unsigned int consumed;
|
||||
enum jtokentype tt = getJsonToken(tokenVal, consumed, s.c_str());
|
||||
enum jtokentype tt = getJsonToken(tokenVal, consumed, s.data(), s.data() + s.size());
|
||||
return (tt == JTOK_NUMBER);
|
||||
}
|
||||
|
||||
bool UniValue::setNumStr(const string& val_)
|
||||
bool UniValue::setNumStr(const std::string& val_)
|
||||
{
|
||||
if (!validNumStr(val_))
|
||||
return false;
|
||||
|
@ -121,7 +56,7 @@ bool UniValue::setNumStr(const string& val_)
|
|||
|
||||
bool UniValue::setInt(uint64_t val_)
|
||||
{
|
||||
ostringstream oss;
|
||||
std::ostringstream oss;
|
||||
|
||||
oss << val_;
|
||||
|
||||
|
@ -130,7 +65,7 @@ bool UniValue::setInt(uint64_t val_)
|
|||
|
||||
bool UniValue::setInt(int64_t val_)
|
||||
{
|
||||
ostringstream oss;
|
||||
std::ostringstream oss;
|
||||
|
||||
oss << val_;
|
||||
|
||||
|
@ -139,7 +74,7 @@ bool UniValue::setInt(int64_t val_)
|
|||
|
||||
bool UniValue::setFloat(double val_)
|
||||
{
|
||||
ostringstream oss;
|
||||
std::ostringstream oss;
|
||||
|
||||
oss << std::setprecision(16) << val_;
|
||||
|
||||
|
@ -148,7 +83,7 @@ bool UniValue::setFloat(double val_)
|
|||
return ret;
|
||||
}
|
||||
|
||||
bool UniValue::setStr(const string& val_)
|
||||
bool UniValue::setStr(const std::string& val_)
|
||||
{
|
||||
clear();
|
||||
typ = VSTR;
|
||||
|
@ -189,13 +124,22 @@ bool UniValue::push_backV(const std::vector<UniValue>& vec)
|
|||
return true;
|
||||
}
|
||||
|
||||
void UniValue::__pushKV(const std::string& key, const UniValue& val_)
|
||||
{
|
||||
keys.push_back(key);
|
||||
values.push_back(val_);
|
||||
}
|
||||
|
||||
bool UniValue::pushKV(const std::string& key, const UniValue& val_)
|
||||
{
|
||||
if (typ != VOBJ)
|
||||
return false;
|
||||
|
||||
keys.push_back(key);
|
||||
values.push_back(val_);
|
||||
size_t idx;
|
||||
if (findKey(key, idx))
|
||||
values[idx] = val_;
|
||||
else
|
||||
__pushKV(key, val_);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -204,34 +148,49 @@ bool UniValue::pushKVs(const UniValue& obj)
|
|||
if (typ != VOBJ || obj.typ != VOBJ)
|
||||
return false;
|
||||
|
||||
for (unsigned int i = 0; i < obj.keys.size(); i++) {
|
||||
keys.push_back(obj.keys[i]);
|
||||
values.push_back(obj.values.at(i));
|
||||
}
|
||||
for (size_t i = 0; i < obj.keys.size(); i++)
|
||||
__pushKV(obj.keys[i], obj.values.at(i));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int UniValue::findKey(const std::string& key) const
|
||||
void UniValue::getObjMap(std::map<std::string,UniValue>& kv) const
|
||||
{
|
||||
for (unsigned int i = 0; i < keys.size(); i++) {
|
||||
if (keys[i] == key)
|
||||
return (int) i;
|
||||
}
|
||||
if (typ != VOBJ)
|
||||
return;
|
||||
|
||||
return -1;
|
||||
kv.clear();
|
||||
for (size_t i = 0; i < keys.size(); i++)
|
||||
kv[keys[i]] = values[i];
|
||||
}
|
||||
|
||||
bool UniValue::checkObject(const std::map<std::string,UniValue::VType>& t)
|
||||
bool UniValue::findKey(const std::string& key, size_t& retIdx) const
|
||||
{
|
||||
for (std::map<std::string,UniValue::VType>::const_iterator it = t.begin();
|
||||
it != t.end(); ++it) {
|
||||
int idx = findKey(it->first);
|
||||
if (idx < 0)
|
||||
return false;
|
||||
for (size_t i = 0; i < keys.size(); i++) {
|
||||
if (keys[i] == key) {
|
||||
retIdx = i;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (values.at(idx).getType() != it->second)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool UniValue::checkObject(const std::map<std::string,UniValue::VType>& t) const
|
||||
{
|
||||
if (typ != VOBJ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (const auto& object: t) {
|
||||
size_t idx = 0;
|
||||
if (!findKey(object.first, idx)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (values.at(idx).getType() != object.second) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -242,14 +201,14 @@ const UniValue& UniValue::operator[](const std::string& key) const
|
|||
if (typ != VOBJ)
|
||||
return NullUniValue;
|
||||
|
||||
int index = findKey(key);
|
||||
if (index < 0)
|
||||
size_t index = 0;
|
||||
if (!findKey(key, index))
|
||||
return NullUniValue;
|
||||
|
||||
return values.at(index);
|
||||
}
|
||||
|
||||
const UniValue& UniValue::operator[](unsigned int index) const
|
||||
const UniValue& UniValue::operator[](size_t index) const
|
||||
{
|
||||
if (typ != VOBJ && typ != VARR)
|
||||
return NullUniValue;
|
||||
|
@ -271,7 +230,7 @@ const char *uvTypeName(UniValue::VType t)
|
|||
}
|
||||
|
||||
// not reached
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const UniValue& find_value(const UniValue& obj, const std::string& name)
|
||||
|
@ -283,75 +242,3 @@ const UniValue& find_value(const UniValue& obj, const std::string& name)
|
|||
return NullUniValue;
|
||||
}
|
||||
|
||||
const std::vector<std::string>& UniValue::getKeys() const
|
||||
{
|
||||
if (typ != VOBJ)
|
||||
throw std::runtime_error("JSON value is not an object as expected");
|
||||
return keys;
|
||||
}
|
||||
|
||||
const std::vector<UniValue>& UniValue::getValues() const
|
||||
{
|
||||
if (typ != VOBJ && typ != VARR)
|
||||
throw std::runtime_error("JSON value is not an object or array as expected");
|
||||
return values;
|
||||
}
|
||||
|
||||
bool UniValue::get_bool() const
|
||||
{
|
||||
if (typ != VBOOL)
|
||||
throw std::runtime_error("JSON value is not a boolean as expected");
|
||||
return getBool();
|
||||
}
|
||||
|
||||
const std::string& UniValue::get_str() const
|
||||
{
|
||||
if (typ != VSTR)
|
||||
throw std::runtime_error("JSON value is not a string as expected");
|
||||
return getValStr();
|
||||
}
|
||||
|
||||
int UniValue::get_int() const
|
||||
{
|
||||
if (typ != VNUM)
|
||||
throw std::runtime_error("JSON value is not an integer as expected");
|
||||
int32_t retval;
|
||||
if (!ParseInt32(getValStr(), &retval))
|
||||
throw std::runtime_error("JSON integer out of range");
|
||||
return retval;
|
||||
}
|
||||
|
||||
int64_t UniValue::get_int64() const
|
||||
{
|
||||
if (typ != VNUM)
|
||||
throw std::runtime_error("JSON value is not an integer as expected");
|
||||
int64_t retval;
|
||||
if (!ParseInt64(getValStr(), &retval))
|
||||
throw std::runtime_error("JSON integer out of range");
|
||||
return retval;
|
||||
}
|
||||
|
||||
double UniValue::get_real() const
|
||||
{
|
||||
if (typ != VNUM)
|
||||
throw std::runtime_error("JSON value is not a number as expected");
|
||||
double retval;
|
||||
if (!ParseDouble(getValStr(), &retval))
|
||||
throw std::runtime_error("JSON double out of range");
|
||||
return retval;
|
||||
}
|
||||
|
||||
const UniValue& UniValue::get_obj() const
|
||||
{
|
||||
if (typ != VOBJ)
|
||||
throw std::runtime_error("JSON value is not an object as expected");
|
||||
return *this;
|
||||
}
|
||||
|
||||
const UniValue& UniValue::get_array() const
|
||||
{
|
||||
if (typ != VARR)
|
||||
throw std::runtime_error("JSON value is not an array as expected");
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,229 +34,229 @@ static const char *escapes[256] = {
|
|||
"\\u001d",
|
||||
"\\u001e",
|
||||
"\\u001f",
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
"\\\"",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
"\\\\",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
"\\u007f",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
};
|
||||
#endif // BITCOIN_UNIVALUE_UNIVALUE_ESCAPES_H
|
||||
|
|
|
@ -0,0 +1,148 @@
|
|||
// Copyright 2014 BitPay Inc.
|
||||
// Copyright 2015 Bitcoin Core Developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or https://opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdexcept>
|
||||
#include <vector>
|
||||
#include <limits>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
#include "univalue.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
static bool ParsePrechecks(const std::string& str)
|
||||
{
|
||||
if (str.empty()) // No empty string allowed
|
||||
return false;
|
||||
if (str.size() >= 1 && (json_isspace(str[0]) || json_isspace(str[str.size()-1]))) // No padding allowed
|
||||
return false;
|
||||
if (str.size() != strlen(str.c_str())) // No embedded NUL characters allowed
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ParseInt32(const std::string& str, int32_t *out)
|
||||
{
|
||||
if (!ParsePrechecks(str))
|
||||
return false;
|
||||
char *endp = nullptr;
|
||||
errno = 0; // strtol will not set errno if valid
|
||||
long int n = strtol(str.c_str(), &endp, 10);
|
||||
if(out) *out = (int32_t)n;
|
||||
// Note that strtol returns a *long int*, so even if strtol doesn't report an over/underflow
|
||||
// we still have to check that the returned value is within the range of an *int32_t*. On 64-bit
|
||||
// platforms the size of these types may be different.
|
||||
return endp && *endp == 0 && !errno &&
|
||||
n >= std::numeric_limits<int32_t>::min() &&
|
||||
n <= std::numeric_limits<int32_t>::max();
|
||||
}
|
||||
|
||||
bool ParseInt64(const std::string& str, int64_t *out)
|
||||
{
|
||||
if (!ParsePrechecks(str))
|
||||
return false;
|
||||
char *endp = nullptr;
|
||||
errno = 0; // strtoll will not set errno if valid
|
||||
long long int n = strtoll(str.c_str(), &endp, 10);
|
||||
if(out) *out = (int64_t)n;
|
||||
// Note that strtoll returns a *long long int*, so even if strtol doesn't report a over/underflow
|
||||
// we still have to check that the returned value is within the range of an *int64_t*.
|
||||
return endp && *endp == 0 && !errno &&
|
||||
n >= std::numeric_limits<int64_t>::min() &&
|
||||
n <= std::numeric_limits<int64_t>::max();
|
||||
}
|
||||
|
||||
bool ParseDouble(const std::string& str, double *out)
|
||||
{
|
||||
if (!ParsePrechecks(str))
|
||||
return false;
|
||||
if (str.size() >= 2 && str[0] == '0' && str[1] == 'x') // No hexadecimal floats allowed
|
||||
return false;
|
||||
std::istringstream text(str);
|
||||
text.imbue(std::locale::classic());
|
||||
double result;
|
||||
text >> result;
|
||||
if(out) *out = result;
|
||||
return text.eof() && !text.fail();
|
||||
}
|
||||
}
|
||||
|
||||
const std::vector<std::string>& UniValue::getKeys() const
|
||||
{
|
||||
if (typ != VOBJ)
|
||||
throw std::runtime_error("JSON value is not an object as expected");
|
||||
return keys;
|
||||
}
|
||||
|
||||
const std::vector<UniValue>& UniValue::getValues() const
|
||||
{
|
||||
if (typ != VOBJ && typ != VARR)
|
||||
throw std::runtime_error("JSON value is not an object or array as expected");
|
||||
return values;
|
||||
}
|
||||
|
||||
bool UniValue::get_bool() const
|
||||
{
|
||||
if (typ != VBOOL)
|
||||
throw std::runtime_error("JSON value is not a boolean as expected");
|
||||
return getBool();
|
||||
}
|
||||
|
||||
const std::string& UniValue::get_str() const
|
||||
{
|
||||
if (typ != VSTR)
|
||||
throw std::runtime_error("JSON value is not a string as expected");
|
||||
return getValStr();
|
||||
}
|
||||
|
||||
int UniValue::get_int() const
|
||||
{
|
||||
if (typ != VNUM)
|
||||
throw std::runtime_error("JSON value is not an integer as expected");
|
||||
int32_t retval;
|
||||
if (!ParseInt32(getValStr(), &retval))
|
||||
throw std::runtime_error("JSON integer out of range");
|
||||
return retval;
|
||||
}
|
||||
|
||||
int64_t UniValue::get_int64() const
|
||||
{
|
||||
if (typ != VNUM)
|
||||
throw std::runtime_error("JSON value is not an integer as expected");
|
||||
int64_t retval;
|
||||
if (!ParseInt64(getValStr(), &retval))
|
||||
throw std::runtime_error("JSON integer out of range");
|
||||
return retval;
|
||||
}
|
||||
|
||||
double UniValue::get_real() const
|
||||
{
|
||||
if (typ != VNUM)
|
||||
throw std::runtime_error("JSON value is not a number as expected");
|
||||
double retval;
|
||||
if (!ParseDouble(getValStr(), &retval))
|
||||
throw std::runtime_error("JSON double out of range");
|
||||
return retval;
|
||||
}
|
||||
|
||||
const UniValue& UniValue::get_obj() const
|
||||
{
|
||||
if (typ != VOBJ)
|
||||
throw std::runtime_error("JSON value is not an object as expected");
|
||||
return *this;
|
||||
}
|
||||
|
||||
const UniValue& UniValue::get_array() const
|
||||
{
|
||||
if (typ != VARR)
|
||||
throw std::runtime_error("JSON value is not an array as expected");
|
||||
return *this;
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright 2014 BitPay Inc.
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
// file COPYING or https://opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <string.h>
|
||||
#include <vector>
|
||||
|
@ -8,7 +8,13 @@
|
|||
#include "univalue.h"
|
||||
#include "univalue_utffilter.h"
|
||||
|
||||
using namespace std;
|
||||
/*
|
||||
* According to stackexchange, the original json test suite wanted
|
||||
* to limit depth to 22. Widely-deployed PHP bails at depth 512,
|
||||
* so we will follow PHP's lead, which should be more than sufficient
|
||||
* (further stackexchange comments indicate depth > 32 rarely occurs).
|
||||
*/
|
||||
static const size_t MAX_JSON_DEPTH = 512;
|
||||
|
||||
static bool json_isdigit(int ch)
|
||||
{
|
||||
|
@ -42,22 +48,22 @@ static const char *hatoui(const char *first, const char *last,
|
|||
return first;
|
||||
}
|
||||
|
||||
enum jtokentype getJsonToken(string& tokenVal, unsigned int& consumed,
|
||||
const char *raw)
|
||||
enum jtokentype getJsonToken(std::string& tokenVal, unsigned int& consumed,
|
||||
const char *raw, const char *end)
|
||||
{
|
||||
tokenVal.clear();
|
||||
consumed = 0;
|
||||
|
||||
const char *rawStart = raw;
|
||||
|
||||
while ((*raw) && (json_isspace(*raw))) // skip whitespace
|
||||
while (raw < end && (json_isspace(*raw))) // skip whitespace
|
||||
raw++;
|
||||
|
||||
switch (*raw) {
|
||||
|
||||
case 0:
|
||||
if (raw >= end)
|
||||
return JTOK_NONE;
|
||||
|
||||
switch (*raw) {
|
||||
|
||||
case '{':
|
||||
raw++;
|
||||
consumed = (raw - rawStart);
|
||||
|
@ -114,7 +120,7 @@ enum jtokentype getJsonToken(string& tokenVal, unsigned int& consumed,
|
|||
case '8':
|
||||
case '9': {
|
||||
// part 1: int
|
||||
string numStr;
|
||||
std::string numStr;
|
||||
|
||||
const char *first = raw;
|
||||
|
||||
|
@ -127,40 +133,40 @@ enum jtokentype getJsonToken(string& tokenVal, unsigned int& consumed,
|
|||
numStr += *raw; // copy first char
|
||||
raw++;
|
||||
|
||||
if ((*first == '-') && (!json_isdigit(*raw)))
|
||||
if ((*first == '-') && (raw < end) && (!json_isdigit(*raw)))
|
||||
return JTOK_ERR;
|
||||
|
||||
while ((*raw) && json_isdigit(*raw)) { // copy digits
|
||||
while (raw < end && json_isdigit(*raw)) { // copy digits
|
||||
numStr += *raw;
|
||||
raw++;
|
||||
}
|
||||
|
||||
// part 2: frac
|
||||
if (*raw == '.') {
|
||||
if (raw < end && *raw == '.') {
|
||||
numStr += *raw; // copy .
|
||||
raw++;
|
||||
|
||||
if (!json_isdigit(*raw))
|
||||
if (raw >= end || !json_isdigit(*raw))
|
||||
return JTOK_ERR;
|
||||
while ((*raw) && json_isdigit(*raw)) { // copy digits
|
||||
while (raw < end && json_isdigit(*raw)) { // copy digits
|
||||
numStr += *raw;
|
||||
raw++;
|
||||
}
|
||||
}
|
||||
|
||||
// part 3: exp
|
||||
if (*raw == 'e' || *raw == 'E') {
|
||||
if (raw < end && (*raw == 'e' || *raw == 'E')) {
|
||||
numStr += *raw; // copy E
|
||||
raw++;
|
||||
|
||||
if (*raw == '-' || *raw == '+') { // copy +/-
|
||||
if (raw < end && (*raw == '-' || *raw == '+')) { // copy +/-
|
||||
numStr += *raw;
|
||||
raw++;
|
||||
}
|
||||
|
||||
if (!json_isdigit(*raw))
|
||||
if (raw >= end || !json_isdigit(*raw))
|
||||
return JTOK_ERR;
|
||||
while ((*raw) && json_isdigit(*raw)) { // copy digits
|
||||
while (raw < end && json_isdigit(*raw)) { // copy digits
|
||||
numStr += *raw;
|
||||
raw++;
|
||||
}
|
||||
|
@ -174,16 +180,19 @@ enum jtokentype getJsonToken(string& tokenVal, unsigned int& consumed,
|
|||
case '"': {
|
||||
raw++; // skip "
|
||||
|
||||
string valStr;
|
||||
std::string valStr;
|
||||
JSONUTF8StringFilter writer(valStr);
|
||||
|
||||
while (*raw) {
|
||||
if ((unsigned char)*raw < 0x20)
|
||||
while (true) {
|
||||
if (raw >= end || (unsigned char)*raw < 0x20)
|
||||
return JTOK_ERR;
|
||||
|
||||
else if (*raw == '\\') {
|
||||
raw++; // skip backslash
|
||||
|
||||
if (raw >= end)
|
||||
return JTOK_ERR;
|
||||
|
||||
switch (*raw) {
|
||||
case '"': writer.push_back('\"'); break;
|
||||
case '\\': writer.push_back('\\'); break;
|
||||
|
@ -196,7 +205,8 @@ enum jtokentype getJsonToken(string& tokenVal, unsigned int& consumed,
|
|||
|
||||
case 'u': {
|
||||
unsigned int codepoint;
|
||||
if (hatoui(raw + 1, raw + 1 + 4, codepoint) !=
|
||||
if (raw + 1 + 4 >= end ||
|
||||
hatoui(raw + 1, raw + 1 + 4, codepoint) !=
|
||||
raw + 1 + 4)
|
||||
return JTOK_ERR;
|
||||
writer.push_back_u(codepoint);
|
||||
|
@ -217,7 +227,7 @@ enum jtokentype getJsonToken(string& tokenVal, unsigned int& consumed,
|
|||
}
|
||||
|
||||
else {
|
||||
writer.push_back(*raw);
|
||||
writer.push_back(static_cast<unsigned char>(*raw));
|
||||
raw++;
|
||||
}
|
||||
}
|
||||
|
@ -234,7 +244,7 @@ enum jtokentype getJsonToken(string& tokenVal, unsigned int& consumed,
|
|||
}
|
||||
}
|
||||
|
||||
enum expect_bits {
|
||||
enum expect_bits : unsigned {
|
||||
EXP_OBJ_NAME = (1U << 0),
|
||||
EXP_COLON = (1U << 1),
|
||||
EXP_ARR_VALUE = (1U << 2),
|
||||
|
@ -246,21 +256,22 @@ enum expect_bits {
|
|||
#define setExpect(bit) (expectMask |= EXP_##bit)
|
||||
#define clearExpect(bit) (expectMask &= ~EXP_##bit)
|
||||
|
||||
bool UniValue::read(const char *raw)
|
||||
bool UniValue::read(const char *raw, size_t size)
|
||||
{
|
||||
clear();
|
||||
|
||||
uint32_t expectMask = 0;
|
||||
vector<UniValue*> stack;
|
||||
std::vector<UniValue*> stack;
|
||||
|
||||
string tokenVal;
|
||||
std::string tokenVal;
|
||||
unsigned int consumed;
|
||||
enum jtokentype tok = JTOK_NONE;
|
||||
enum jtokentype last_tok = JTOK_NONE;
|
||||
const char* end = raw + size;
|
||||
do {
|
||||
last_tok = tok;
|
||||
|
||||
tok = getJsonToken(tokenVal, consumed, raw);
|
||||
tok = getJsonToken(tokenVal, consumed, raw, end);
|
||||
if (tok == JTOK_NONE || tok == JTOK_ERR)
|
||||
return false;
|
||||
raw += consumed;
|
||||
|
@ -320,6 +331,9 @@ bool UniValue::read(const char *raw)
|
|||
stack.push_back(newTop);
|
||||
}
|
||||
|
||||
if (stack.size() > MAX_JSON_DEPTH)
|
||||
return false;
|
||||
|
||||
if (utyp == VOBJ)
|
||||
setExpect(OBJ_NAME);
|
||||
else
|
||||
|
@ -371,9 +385,6 @@ bool UniValue::read(const char *raw)
|
|||
case JTOK_KW_NULL:
|
||||
case JTOK_KW_TRUE:
|
||||
case JTOK_KW_FALSE: {
|
||||
if (!stack.size())
|
||||
return false;
|
||||
|
||||
UniValue tmpVal;
|
||||
switch (tok) {
|
||||
case JTOK_KW_NULL:
|
||||
|
@ -388,6 +399,11 @@ bool UniValue::read(const char *raw)
|
|||
default: /* impossible */ break;
|
||||
}
|
||||
|
||||
if (!stack.size()) {
|
||||
*this = tmpVal;
|
||||
break;
|
||||
}
|
||||
|
||||
UniValue *top = stack.back();
|
||||
top->values.push_back(tmpVal);
|
||||
|
||||
|
@ -396,10 +412,12 @@ bool UniValue::read(const char *raw)
|
|||
}
|
||||
|
||||
case JTOK_NUMBER: {
|
||||
if (!stack.size())
|
||||
return false;
|
||||
|
||||
UniValue tmpVal(VNUM, tokenVal);
|
||||
if (!stack.size()) {
|
||||
*this = tmpVal;
|
||||
break;
|
||||
}
|
||||
|
||||
UniValue *top = stack.back();
|
||||
top->values.push_back(tmpVal);
|
||||
|
||||
|
@ -408,17 +426,18 @@ bool UniValue::read(const char *raw)
|
|||
}
|
||||
|
||||
case JTOK_STRING: {
|
||||
if (!stack.size())
|
||||
return false;
|
||||
|
||||
UniValue *top = stack.back();
|
||||
|
||||
if (expect(OBJ_NAME)) {
|
||||
UniValue *top = stack.back();
|
||||
top->keys.push_back(tokenVal);
|
||||
clearExpect(OBJ_NAME);
|
||||
setExpect(COLON);
|
||||
} else {
|
||||
UniValue tmpVal(VSTR, tokenVal);
|
||||
if (!stack.size()) {
|
||||
*this = tmpVal;
|
||||
break;
|
||||
}
|
||||
UniValue *top = stack.back();
|
||||
top->values.push_back(tmpVal);
|
||||
}
|
||||
|
||||
|
@ -432,7 +451,7 @@ bool UniValue::read(const char *raw)
|
|||
} while (!stack.empty ());
|
||||
|
||||
/* Check that nothing follows the initial construct (parsed above). */
|
||||
tok = getJsonToken(tokenVal, consumed, raw);
|
||||
tok = getJsonToken(tokenVal, consumed, raw, end);
|
||||
if (tok != JTOK_NONE)
|
||||
return false;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright 2016 Wladimir J. van der Laan
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
// file COPYING or https://opensource.org/licenses/mit-license.php.
|
||||
#ifndef UNIVALUE_UTFFILTER_H
|
||||
#define UNIVALUE_UTFFILTER_H
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
|||
class JSONUTF8StringFilter
|
||||
{
|
||||
public:
|
||||
JSONUTF8StringFilter(std::string &s):
|
||||
explicit JSONUTF8StringFilter(std::string &s):
|
||||
str(s), is_valid(true), codepoint(0), state(0), surpair(0)
|
||||
{
|
||||
}
|
||||
|
@ -46,19 +46,19 @@ public:
|
|||
}
|
||||
}
|
||||
// Write codepoint directly, possibly collating surrogate pairs
|
||||
void push_back_u(unsigned int codepoint)
|
||||
void push_back_u(unsigned int codepoint_)
|
||||
{
|
||||
if (state) // Only accept full codepoints in open state
|
||||
is_valid = false;
|
||||
if (codepoint >= 0xD800 && codepoint < 0xDC00) { // First half of surrogate pair
|
||||
if (codepoint_ >= 0xD800 && codepoint_ < 0xDC00) { // First half of surrogate pair
|
||||
if (surpair) // Two subsequent surrogate pair openers - fail
|
||||
is_valid = false;
|
||||
else
|
||||
surpair = codepoint;
|
||||
} else if (codepoint >= 0xDC00 && codepoint < 0xE000) { // Second half of surrogate pair
|
||||
surpair = codepoint_;
|
||||
} else if (codepoint_ >= 0xDC00 && codepoint_ < 0xE000) { // Second half of surrogate pair
|
||||
if (surpair) { // Open surrogate pair, expect second half
|
||||
// Compute code point from UTF-16 surrogate pair
|
||||
append_codepoint(0x10000 | ((surpair - 0xD800)<<10) | (codepoint - 0xDC00));
|
||||
append_codepoint(0x10000 | ((surpair - 0xD800)<<10) | (codepoint_ - 0xDC00));
|
||||
surpair = 0;
|
||||
} else // Second half doesn't follow a first half - fail
|
||||
is_valid = false;
|
||||
|
@ -66,7 +66,7 @@ public:
|
|||
if (surpair) // First half of surrogate pair not followed by second - fail
|
||||
is_valid = false;
|
||||
else
|
||||
append_codepoint(codepoint);
|
||||
append_codepoint(codepoint_);
|
||||
}
|
||||
}
|
||||
// Check that we're in a state where the string can be ended
|
||||
|
@ -96,22 +96,22 @@ private:
|
|||
// Two subsequent \u.... may have to be replaced with one actual codepoint.
|
||||
unsigned int surpair; // First half of open UTF-16 surrogate pair, or 0
|
||||
|
||||
void append_codepoint(unsigned int codepoint)
|
||||
void append_codepoint(unsigned int codepoint_)
|
||||
{
|
||||
if (codepoint <= 0x7f)
|
||||
str.push_back((char)codepoint);
|
||||
else if (codepoint <= 0x7FF) {
|
||||
str.push_back((char)(0xC0 | (codepoint >> 6)));
|
||||
str.push_back((char)(0x80 | (codepoint & 0x3F)));
|
||||
} else if (codepoint <= 0xFFFF) {
|
||||
str.push_back((char)(0xE0 | (codepoint >> 12)));
|
||||
str.push_back((char)(0x80 | ((codepoint >> 6) & 0x3F)));
|
||||
str.push_back((char)(0x80 | (codepoint & 0x3F)));
|
||||
} else if (codepoint <= 0x1FFFFF) {
|
||||
str.push_back((char)(0xF0 | (codepoint >> 18)));
|
||||
str.push_back((char)(0x80 | ((codepoint >> 12) & 0x3F)));
|
||||
str.push_back((char)(0x80 | ((codepoint >> 6) & 0x3F)));
|
||||
str.push_back((char)(0x80 | (codepoint & 0x3F)));
|
||||
if (codepoint_ <= 0x7f)
|
||||
str.push_back((char)codepoint_);
|
||||
else if (codepoint_ <= 0x7FF) {
|
||||
str.push_back((char)(0xC0 | (codepoint_ >> 6)));
|
||||
str.push_back((char)(0x80 | (codepoint_ & 0x3F)));
|
||||
} else if (codepoint_ <= 0xFFFF) {
|
||||
str.push_back((char)(0xE0 | (codepoint_ >> 12)));
|
||||
str.push_back((char)(0x80 | ((codepoint_ >> 6) & 0x3F)));
|
||||
str.push_back((char)(0x80 | (codepoint_ & 0x3F)));
|
||||
} else if (codepoint_ <= 0x1FFFFF) {
|
||||
str.push_back((char)(0xF0 | (codepoint_ >> 18)));
|
||||
str.push_back((char)(0x80 | ((codepoint_ >> 12) & 0x3F)));
|
||||
str.push_back((char)(0x80 | ((codepoint_ >> 6) & 0x3F)));
|
||||
str.push_back((char)(0x80 | (codepoint_ & 0x3F)));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,37 +1,34 @@
|
|||
// Copyright 2014 BitPay Inc.
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
// file COPYING or https://opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
#include <stdio.h>
|
||||
#include "univalue.h"
|
||||
#include "univalue_escapes.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
static string json_escape(const string& inS)
|
||||
static std::string json_escape(const std::string& inS)
|
||||
{
|
||||
string outS;
|
||||
std::string outS;
|
||||
outS.reserve(inS.size() * 2);
|
||||
|
||||
for (unsigned int i = 0; i < inS.size(); i++) {
|
||||
unsigned char ch = inS[i];
|
||||
unsigned char ch = static_cast<unsigned char>(inS[i]);
|
||||
const char *escStr = escapes[ch];
|
||||
|
||||
if (escStr)
|
||||
outS += escStr;
|
||||
else
|
||||
outS += ch;
|
||||
outS += static_cast<char>(ch);
|
||||
}
|
||||
|
||||
return outS;
|
||||
}
|
||||
|
||||
string UniValue::write(unsigned int prettyIndent,
|
||||
unsigned int indentLevel) const
|
||||
std::string UniValue::write(unsigned int prettyIndent,
|
||||
unsigned int indentLevel) const
|
||||
{
|
||||
string s;
|
||||
std::string s;
|
||||
s.reserve(1024);
|
||||
|
||||
unsigned int modIndent = indentLevel;
|
||||
|
@ -62,12 +59,12 @@ string UniValue::write(unsigned int prettyIndent,
|
|||
return s;
|
||||
}
|
||||
|
||||
static void indentStr(unsigned int prettyIndent, unsigned int indentLevel, string& s)
|
||||
static void indentStr(unsigned int prettyIndent, unsigned int indentLevel, std::string& s)
|
||||
{
|
||||
s.append(prettyIndent * indentLevel, ' ');
|
||||
}
|
||||
|
||||
void UniValue::writeArray(unsigned int prettyIndent, unsigned int indentLevel, string& s) const
|
||||
void UniValue::writeArray(unsigned int prettyIndent, unsigned int indentLevel, std::string& s) const
|
||||
{
|
||||
s += "[";
|
||||
if (prettyIndent)
|
||||
|
@ -79,8 +76,6 @@ void UniValue::writeArray(unsigned int prettyIndent, unsigned int indentLevel, s
|
|||
s += values[i].write(prettyIndent, indentLevel + 1);
|
||||
if (i != (values.size() - 1)) {
|
||||
s += ",";
|
||||
if (prettyIndent)
|
||||
s += " ";
|
||||
}
|
||||
if (prettyIndent)
|
||||
s += "\n";
|
||||
|
@ -91,7 +86,7 @@ void UniValue::writeArray(unsigned int prettyIndent, unsigned int indentLevel, s
|
|||
s += "]";
|
||||
}
|
||||
|
||||
void UniValue::writeObject(unsigned int prettyIndent, unsigned int indentLevel, string& s) const
|
||||
void UniValue::writeObject(unsigned int prettyIndent, unsigned int indentLevel, std::string& s) const
|
||||
{
|
||||
s += "{";
|
||||
if (prettyIndent)
|
||||
|
|
|
@ -0,0 +1,95 @@
|
|||
# - All variables are namespaced with UNIVALUE_ to avoid colliding with
|
||||
# downstream makefiles.
|
||||
# - All Variables ending in _HEADERS or _SOURCES confuse automake, so the
|
||||
# _INT postfix is applied.
|
||||
# - Convenience variables, for example a UNIVALUE_TEST_DIR should not be used
|
||||
# as they interfere with automatic dependency generation
|
||||
# - The %reldir% is the relative path from the Makefile.am. This allows
|
||||
# downstreams to use these variables without having to manually account for
|
||||
# the path change.
|
||||
|
||||
UNIVALUE_INCLUDE_DIR_INT = %reldir%/include
|
||||
|
||||
UNIVALUE_DIST_HEADERS_INT =
|
||||
UNIVALUE_DIST_HEADERS_INT += %reldir%/include/univalue.h
|
||||
|
||||
UNIVALUE_LIB_HEADERS_INT =
|
||||
UNIVALUE_LIB_HEADERS_INT += %reldir%/lib/univalue_utffilter.h
|
||||
UNIVALUE_LIB_HEADERS_INT += %reldir%/lib/univalue_escapes.h
|
||||
|
||||
UNIVALUE_LIB_SOURCES_INT =
|
||||
UNIVALUE_LIB_SOURCES_INT += %reldir%/lib/univalue.cpp
|
||||
UNIVALUE_LIB_SOURCES_INT += %reldir%/lib/univalue_get.cpp
|
||||
UNIVALUE_LIB_SOURCES_INT += %reldir%/lib/univalue_read.cpp
|
||||
UNIVALUE_LIB_SOURCES_INT += %reldir%/lib/univalue_write.cpp
|
||||
|
||||
UNIVALUE_TEST_DATA_DIR_INT = %reldir%/test
|
||||
|
||||
UNIVALUE_TEST_UNITESTER_INT =
|
||||
UNIVALUE_TEST_UNITESTER_INT += %reldir%/test/unitester.cpp
|
||||
|
||||
UNIVALUE_TEST_JSON_INT =
|
||||
UNIVALUE_TEST_JSON_INT += %reldir%/test/test_json.cpp
|
||||
|
||||
UNIVALUE_TEST_NO_NUL_INT =
|
||||
UNIVALUE_TEST_NO_NUL_INT += %reldir%/test/no_nul.cpp
|
||||
|
||||
UNIVALUE_TEST_OBJECT_INT =
|
||||
UNIVALUE_TEST_OBJECT_INT += %reldir%/test/object.cpp
|
||||
|
||||
UNIVALUE_TEST_FILES_INT =
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail1.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail2.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail3.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail4.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail5.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail6.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail7.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail8.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail9.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail10.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail11.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail12.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail13.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail14.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail15.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail16.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail17.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail18.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail19.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail20.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail21.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail22.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail23.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail24.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail25.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail26.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail27.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail28.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail29.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail30.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail31.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail32.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail33.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail34.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail35.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail36.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail37.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail38.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail39.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail40.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail41.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail42.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail44.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail45.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/pass1.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/pass2.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/pass3.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/pass4.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/round1.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/round2.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/round3.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/round4.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/round5.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/round6.json
|
||||
UNIVALUE_TEST_FILES_INT += %reldir%/test/round7.json
|
|
@ -1,4 +1,8 @@
|
|||
|
||||
object
|
||||
unitester
|
||||
test_json
|
||||
no_nul
|
||||
|
||||
*.trs
|
||||
*.log
|
||||
|
|
|
@ -1 +1 @@
|
|||
"A JSON payload should be an object or array, not a string."
|
||||
"This is a string that never ends, yes it goes on and on, my friends.
|
||||
|
|
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
"This file ends without a newline or close-quote.
|
|
@ -0,0 +1 @@
|
|||
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
|
|
@ -0,0 +1,8 @@
|
|||
#include "univalue.h"
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
char buf[] = "___[1,2,3]___";
|
||||
UniValue val;
|
||||
return val.read(buf + 3, 7) ? 0 : 1;
|
||||
}
|
|
@ -0,0 +1,420 @@
|
|||
// Copyright (c) 2014 BitPay Inc.
|
||||
// Copyright (c) 2014-2016 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or https://opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <stdint.h>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <cassert>
|
||||
#include <stdexcept>
|
||||
#include <univalue.h>
|
||||
|
||||
#define BOOST_FIXTURE_TEST_SUITE(a, b)
|
||||
#define BOOST_AUTO_TEST_CASE(funcName) void funcName()
|
||||
#define BOOST_AUTO_TEST_SUITE_END()
|
||||
#define BOOST_CHECK(expr) assert(expr)
|
||||
#define BOOST_CHECK_EQUAL(v1, v2) assert((v1) == (v2))
|
||||
#define BOOST_CHECK_THROW(stmt, excMatch) { \
|
||||
try { \
|
||||
(stmt); \
|
||||
assert(0 && "No exception caught"); \
|
||||
} catch (excMatch & e) { \
|
||||
} catch (...) { \
|
||||
assert(0 && "Wrong exception caught"); \
|
||||
} \
|
||||
}
|
||||
#define BOOST_CHECK_NO_THROW(stmt) { \
|
||||
try { \
|
||||
(stmt); \
|
||||
} catch (...) { \
|
||||
assert(0); \
|
||||
} \
|
||||
}
|
||||
|
||||
BOOST_FIXTURE_TEST_SUITE(univalue_tests, BasicTestingSetup)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(univalue_constructor)
|
||||
{
|
||||
UniValue v1;
|
||||
BOOST_CHECK(v1.isNull());
|
||||
|
||||
UniValue v2(UniValue::VSTR);
|
||||
BOOST_CHECK(v2.isStr());
|
||||
|
||||
UniValue v3(UniValue::VSTR, "foo");
|
||||
BOOST_CHECK(v3.isStr());
|
||||
BOOST_CHECK_EQUAL(v3.getValStr(), "foo");
|
||||
|
||||
UniValue numTest;
|
||||
BOOST_CHECK(numTest.setNumStr("82"));
|
||||
BOOST_CHECK(numTest.isNum());
|
||||
BOOST_CHECK_EQUAL(numTest.getValStr(), "82");
|
||||
|
||||
uint64_t vu64 = 82;
|
||||
UniValue v4(vu64);
|
||||
BOOST_CHECK(v4.isNum());
|
||||
BOOST_CHECK_EQUAL(v4.getValStr(), "82");
|
||||
|
||||
int64_t vi64 = -82;
|
||||
UniValue v5(vi64);
|
||||
BOOST_CHECK(v5.isNum());
|
||||
BOOST_CHECK_EQUAL(v5.getValStr(), "-82");
|
||||
|
||||
int vi = -688;
|
||||
UniValue v6(vi);
|
||||
BOOST_CHECK(v6.isNum());
|
||||
BOOST_CHECK_EQUAL(v6.getValStr(), "-688");
|
||||
|
||||
double vd = -7.21;
|
||||
UniValue v7(vd);
|
||||
BOOST_CHECK(v7.isNum());
|
||||
BOOST_CHECK_EQUAL(v7.getValStr(), "-7.21");
|
||||
|
||||
std::string vs("yawn");
|
||||
UniValue v8(vs);
|
||||
BOOST_CHECK(v8.isStr());
|
||||
BOOST_CHECK_EQUAL(v8.getValStr(), "yawn");
|
||||
|
||||
const char *vcs = "zappa";
|
||||
UniValue v9(vcs);
|
||||
BOOST_CHECK(v9.isStr());
|
||||
BOOST_CHECK_EQUAL(v9.getValStr(), "zappa");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(univalue_typecheck)
|
||||
{
|
||||
UniValue v1;
|
||||
BOOST_CHECK(v1.setNumStr("1"));
|
||||
BOOST_CHECK(v1.isNum());
|
||||
BOOST_CHECK_THROW(v1.get_bool(), std::runtime_error);
|
||||
|
||||
UniValue v2;
|
||||
BOOST_CHECK(v2.setBool(true));
|
||||
BOOST_CHECK_EQUAL(v2.get_bool(), true);
|
||||
BOOST_CHECK_THROW(v2.get_int(), std::runtime_error);
|
||||
|
||||
UniValue v3;
|
||||
BOOST_CHECK(v3.setNumStr("32482348723847471234"));
|
||||
BOOST_CHECK_THROW(v3.get_int64(), std::runtime_error);
|
||||
BOOST_CHECK(v3.setNumStr("1000"));
|
||||
BOOST_CHECK_EQUAL(v3.get_int64(), 1000);
|
||||
|
||||
UniValue v4;
|
||||
BOOST_CHECK(v4.setNumStr("2147483648"));
|
||||
BOOST_CHECK_EQUAL(v4.get_int64(), 2147483648);
|
||||
BOOST_CHECK_THROW(v4.get_int(), std::runtime_error);
|
||||
BOOST_CHECK(v4.setNumStr("1000"));
|
||||
BOOST_CHECK_EQUAL(v4.get_int(), 1000);
|
||||
BOOST_CHECK_THROW(v4.get_str(), std::runtime_error);
|
||||
BOOST_CHECK_EQUAL(v4.get_real(), 1000);
|
||||
BOOST_CHECK_THROW(v4.get_array(), std::runtime_error);
|
||||
BOOST_CHECK_THROW(v4.getKeys(), std::runtime_error);
|
||||
BOOST_CHECK_THROW(v4.getValues(), std::runtime_error);
|
||||
BOOST_CHECK_THROW(v4.get_obj(), std::runtime_error);
|
||||
|
||||
UniValue v5;
|
||||
BOOST_CHECK(v5.read("[true, 10]"));
|
||||
BOOST_CHECK_NO_THROW(v5.get_array());
|
||||
std::vector<UniValue> vals = v5.getValues();
|
||||
BOOST_CHECK_THROW(vals[0].get_int(), std::runtime_error);
|
||||
BOOST_CHECK_EQUAL(vals[0].get_bool(), true);
|
||||
|
||||
BOOST_CHECK_EQUAL(vals[1].get_int(), 10);
|
||||
BOOST_CHECK_THROW(vals[1].get_bool(), std::runtime_error);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(univalue_set)
|
||||
{
|
||||
UniValue v(UniValue::VSTR, "foo");
|
||||
v.clear();
|
||||
BOOST_CHECK(v.isNull());
|
||||
BOOST_CHECK_EQUAL(v.getValStr(), "");
|
||||
|
||||
BOOST_CHECK(v.setObject());
|
||||
BOOST_CHECK(v.isObject());
|
||||
BOOST_CHECK_EQUAL(v.size(), 0);
|
||||
BOOST_CHECK_EQUAL(v.getType(), UniValue::VOBJ);
|
||||
BOOST_CHECK(v.empty());
|
||||
|
||||
BOOST_CHECK(v.setArray());
|
||||
BOOST_CHECK(v.isArray());
|
||||
BOOST_CHECK_EQUAL(v.size(), 0);
|
||||
|
||||
BOOST_CHECK(v.setStr("zum"));
|
||||
BOOST_CHECK(v.isStr());
|
||||
BOOST_CHECK_EQUAL(v.getValStr(), "zum");
|
||||
|
||||
BOOST_CHECK(v.setFloat(-1.01));
|
||||
BOOST_CHECK(v.isNum());
|
||||
BOOST_CHECK_EQUAL(v.getValStr(), "-1.01");
|
||||
|
||||
BOOST_CHECK(v.setInt((int)1023));
|
||||
BOOST_CHECK(v.isNum());
|
||||
BOOST_CHECK_EQUAL(v.getValStr(), "1023");
|
||||
|
||||
BOOST_CHECK(v.setInt((int64_t)-1023LL));
|
||||
BOOST_CHECK(v.isNum());
|
||||
BOOST_CHECK_EQUAL(v.getValStr(), "-1023");
|
||||
|
||||
BOOST_CHECK(v.setInt((uint64_t)1023ULL));
|
||||
BOOST_CHECK(v.isNum());
|
||||
BOOST_CHECK_EQUAL(v.getValStr(), "1023");
|
||||
|
||||
BOOST_CHECK(v.setNumStr("-688"));
|
||||
BOOST_CHECK(v.isNum());
|
||||
BOOST_CHECK_EQUAL(v.getValStr(), "-688");
|
||||
|
||||
BOOST_CHECK(v.setBool(false));
|
||||
BOOST_CHECK_EQUAL(v.isBool(), true);
|
||||
BOOST_CHECK_EQUAL(v.isTrue(), false);
|
||||
BOOST_CHECK_EQUAL(v.isFalse(), true);
|
||||
BOOST_CHECK_EQUAL(v.getBool(), false);
|
||||
|
||||
BOOST_CHECK(v.setBool(true));
|
||||
BOOST_CHECK_EQUAL(v.isBool(), true);
|
||||
BOOST_CHECK_EQUAL(v.isTrue(), true);
|
||||
BOOST_CHECK_EQUAL(v.isFalse(), false);
|
||||
BOOST_CHECK_EQUAL(v.getBool(), true);
|
||||
|
||||
BOOST_CHECK(!v.setNumStr("zombocom"));
|
||||
|
||||
BOOST_CHECK(v.setNull());
|
||||
BOOST_CHECK(v.isNull());
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(univalue_array)
|
||||
{
|
||||
UniValue arr(UniValue::VARR);
|
||||
|
||||
UniValue v((int64_t)1023LL);
|
||||
BOOST_CHECK(arr.push_back(v));
|
||||
|
||||
std::string vStr("zippy");
|
||||
BOOST_CHECK(arr.push_back(vStr));
|
||||
|
||||
const char *s = "pippy";
|
||||
BOOST_CHECK(arr.push_back(s));
|
||||
|
||||
std::vector<UniValue> vec;
|
||||
v.setStr("boing");
|
||||
vec.push_back(v);
|
||||
|
||||
v.setStr("going");
|
||||
vec.push_back(v);
|
||||
|
||||
BOOST_CHECK(arr.push_backV(vec));
|
||||
|
||||
BOOST_CHECK(arr.push_back((uint64_t) 400ULL));
|
||||
BOOST_CHECK(arr.push_back((int64_t) -400LL));
|
||||
BOOST_CHECK(arr.push_back((int) -401));
|
||||
BOOST_CHECK(arr.push_back(-40.1));
|
||||
BOOST_CHECK(arr.push_back(true));
|
||||
|
||||
BOOST_CHECK_EQUAL(arr.empty(), false);
|
||||
BOOST_CHECK_EQUAL(arr.size(), 10);
|
||||
|
||||
BOOST_CHECK_EQUAL(arr[0].getValStr(), "1023");
|
||||
BOOST_CHECK_EQUAL(arr[0].getType(), UniValue::VNUM);
|
||||
BOOST_CHECK_EQUAL(arr[1].getValStr(), "zippy");
|
||||
BOOST_CHECK_EQUAL(arr[1].getType(), UniValue::VSTR);
|
||||
BOOST_CHECK_EQUAL(arr[2].getValStr(), "pippy");
|
||||
BOOST_CHECK_EQUAL(arr[2].getType(), UniValue::VSTR);
|
||||
BOOST_CHECK_EQUAL(arr[3].getValStr(), "boing");
|
||||
BOOST_CHECK_EQUAL(arr[3].getType(), UniValue::VSTR);
|
||||
BOOST_CHECK_EQUAL(arr[4].getValStr(), "going");
|
||||
BOOST_CHECK_EQUAL(arr[4].getType(), UniValue::VSTR);
|
||||
BOOST_CHECK_EQUAL(arr[5].getValStr(), "400");
|
||||
BOOST_CHECK_EQUAL(arr[5].getType(), UniValue::VNUM);
|
||||
BOOST_CHECK_EQUAL(arr[6].getValStr(), "-400");
|
||||
BOOST_CHECK_EQUAL(arr[6].getType(), UniValue::VNUM);
|
||||
BOOST_CHECK_EQUAL(arr[7].getValStr(), "-401");
|
||||
BOOST_CHECK_EQUAL(arr[7].getType(), UniValue::VNUM);
|
||||
BOOST_CHECK_EQUAL(arr[8].getValStr(), "-40.1");
|
||||
BOOST_CHECK_EQUAL(arr[8].getType(), UniValue::VNUM);
|
||||
BOOST_CHECK_EQUAL(arr[9].getValStr(), "1");
|
||||
BOOST_CHECK_EQUAL(arr[9].getType(), UniValue::VBOOL);
|
||||
|
||||
BOOST_CHECK_EQUAL(arr[999].getValStr(), "");
|
||||
|
||||
arr.clear();
|
||||
BOOST_CHECK(arr.empty());
|
||||
BOOST_CHECK_EQUAL(arr.size(), 0);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(univalue_object)
|
||||
{
|
||||
UniValue obj(UniValue::VOBJ);
|
||||
std::string strKey, strVal;
|
||||
UniValue v;
|
||||
|
||||
strKey = "age";
|
||||
v.setInt(100);
|
||||
BOOST_CHECK(obj.pushKV(strKey, v));
|
||||
|
||||
strKey = "first";
|
||||
strVal = "John";
|
||||
BOOST_CHECK(obj.pushKV(strKey, strVal));
|
||||
|
||||
strKey = "last";
|
||||
const char *cVal = "Smith";
|
||||
BOOST_CHECK(obj.pushKV(strKey, cVal));
|
||||
|
||||
strKey = "distance";
|
||||
BOOST_CHECK(obj.pushKV(strKey, (int64_t) 25));
|
||||
|
||||
strKey = "time";
|
||||
BOOST_CHECK(obj.pushKV(strKey, (uint64_t) 3600));
|
||||
|
||||
strKey = "calories";
|
||||
BOOST_CHECK(obj.pushKV(strKey, (int) 12));
|
||||
|
||||
strKey = "temperature";
|
||||
BOOST_CHECK(obj.pushKV(strKey, (double) 90.012));
|
||||
|
||||
strKey = "moon";
|
||||
BOOST_CHECK(obj.pushKV(strKey, true));
|
||||
|
||||
strKey = "spoon";
|
||||
BOOST_CHECK(obj.pushKV(strKey, false));
|
||||
|
||||
UniValue obj2(UniValue::VOBJ);
|
||||
BOOST_CHECK(obj2.pushKV("cat1", 9000));
|
||||
BOOST_CHECK(obj2.pushKV("cat2", 12345));
|
||||
|
||||
BOOST_CHECK(obj.pushKVs(obj2));
|
||||
|
||||
BOOST_CHECK_EQUAL(obj.empty(), false);
|
||||
BOOST_CHECK_EQUAL(obj.size(), 11);
|
||||
|
||||
BOOST_CHECK_EQUAL(obj["age"].getValStr(), "100");
|
||||
BOOST_CHECK_EQUAL(obj["first"].getValStr(), "John");
|
||||
BOOST_CHECK_EQUAL(obj["last"].getValStr(), "Smith");
|
||||
BOOST_CHECK_EQUAL(obj["distance"].getValStr(), "25");
|
||||
BOOST_CHECK_EQUAL(obj["time"].getValStr(), "3600");
|
||||
BOOST_CHECK_EQUAL(obj["calories"].getValStr(), "12");
|
||||
BOOST_CHECK_EQUAL(obj["temperature"].getValStr(), "90.012");
|
||||
BOOST_CHECK_EQUAL(obj["moon"].getValStr(), "1");
|
||||
BOOST_CHECK_EQUAL(obj["spoon"].getValStr(), "");
|
||||
BOOST_CHECK_EQUAL(obj["cat1"].getValStr(), "9000");
|
||||
BOOST_CHECK_EQUAL(obj["cat2"].getValStr(), "12345");
|
||||
|
||||
BOOST_CHECK_EQUAL(obj["nyuknyuknyuk"].getValStr(), "");
|
||||
|
||||
BOOST_CHECK(obj.exists("age"));
|
||||
BOOST_CHECK(obj.exists("first"));
|
||||
BOOST_CHECK(obj.exists("last"));
|
||||
BOOST_CHECK(obj.exists("distance"));
|
||||
BOOST_CHECK(obj.exists("time"));
|
||||
BOOST_CHECK(obj.exists("calories"));
|
||||
BOOST_CHECK(obj.exists("temperature"));
|
||||
BOOST_CHECK(obj.exists("moon"));
|
||||
BOOST_CHECK(obj.exists("spoon"));
|
||||
BOOST_CHECK(obj.exists("cat1"));
|
||||
BOOST_CHECK(obj.exists("cat2"));
|
||||
|
||||
BOOST_CHECK(!obj.exists("nyuknyuknyuk"));
|
||||
|
||||
std::map<std::string, UniValue::VType> objTypes;
|
||||
objTypes["age"] = UniValue::VNUM;
|
||||
objTypes["first"] = UniValue::VSTR;
|
||||
objTypes["last"] = UniValue::VSTR;
|
||||
objTypes["distance"] = UniValue::VNUM;
|
||||
objTypes["time"] = UniValue::VNUM;
|
||||
objTypes["calories"] = UniValue::VNUM;
|
||||
objTypes["temperature"] = UniValue::VNUM;
|
||||
objTypes["moon"] = UniValue::VBOOL;
|
||||
objTypes["spoon"] = UniValue::VBOOL;
|
||||
objTypes["cat1"] = UniValue::VNUM;
|
||||
objTypes["cat2"] = UniValue::VNUM;
|
||||
BOOST_CHECK(obj.checkObject(objTypes));
|
||||
|
||||
objTypes["cat2"] = UniValue::VSTR;
|
||||
BOOST_CHECK(!obj.checkObject(objTypes));
|
||||
|
||||
obj.clear();
|
||||
BOOST_CHECK(obj.empty());
|
||||
BOOST_CHECK_EQUAL(obj.size(), 0);
|
||||
BOOST_CHECK_EQUAL(obj.getType(), UniValue::VNULL);
|
||||
|
||||
BOOST_CHECK_EQUAL(obj.setObject(), true);
|
||||
UniValue uv;
|
||||
uv.setInt(42);
|
||||
obj.__pushKV("age", uv);
|
||||
BOOST_CHECK_EQUAL(obj.size(), 1);
|
||||
BOOST_CHECK_EQUAL(obj["age"].getValStr(), "42");
|
||||
|
||||
uv.setInt(43);
|
||||
obj.pushKV("age", uv);
|
||||
BOOST_CHECK_EQUAL(obj.size(), 1);
|
||||
BOOST_CHECK_EQUAL(obj["age"].getValStr(), "43");
|
||||
|
||||
obj.pushKV("name", "foo bar");
|
||||
|
||||
std::map<std::string,UniValue> kv;
|
||||
obj.getObjMap(kv);
|
||||
BOOST_CHECK_EQUAL(kv["age"].getValStr(), "43");
|
||||
BOOST_CHECK_EQUAL(kv["name"].getValStr(), "foo bar");
|
||||
|
||||
}
|
||||
|
||||
static const char *json1 =
|
||||
"[1.10000000,{\"key1\":\"str\\u0000\",\"key2\":800,\"key3\":{\"name\":\"martian http://test.com\"}}]";
|
||||
|
||||
BOOST_AUTO_TEST_CASE(univalue_readwrite)
|
||||
{
|
||||
UniValue v;
|
||||
BOOST_CHECK(v.read(json1));
|
||||
|
||||
std::string strJson1(json1);
|
||||
BOOST_CHECK(v.read(strJson1));
|
||||
|
||||
BOOST_CHECK(v.isArray());
|
||||
BOOST_CHECK_EQUAL(v.size(), 2);
|
||||
|
||||
BOOST_CHECK_EQUAL(v[0].getValStr(), "1.10000000");
|
||||
|
||||
UniValue obj = v[1];
|
||||
BOOST_CHECK(obj.isObject());
|
||||
BOOST_CHECK_EQUAL(obj.size(), 3);
|
||||
|
||||
BOOST_CHECK(obj["key1"].isStr());
|
||||
std::string correctValue("str");
|
||||
correctValue.push_back('\0');
|
||||
BOOST_CHECK_EQUAL(obj["key1"].getValStr(), correctValue);
|
||||
BOOST_CHECK(obj["key2"].isNum());
|
||||
BOOST_CHECK_EQUAL(obj["key2"].getValStr(), "800");
|
||||
BOOST_CHECK(obj["key3"].isObject());
|
||||
|
||||
BOOST_CHECK_EQUAL(strJson1, v.write());
|
||||
|
||||
/* Check for (correctly reporting) a parsing error if the initial
|
||||
JSON construct is followed by more stuff. Note that whitespace
|
||||
is, of course, exempt. */
|
||||
|
||||
BOOST_CHECK(v.read(" {}\n "));
|
||||
BOOST_CHECK(v.isObject());
|
||||
BOOST_CHECK(v.read(" []\n "));
|
||||
BOOST_CHECK(v.isArray());
|
||||
|
||||
BOOST_CHECK(!v.read("@{}"));
|
||||
BOOST_CHECK(!v.read("{} garbage"));
|
||||
BOOST_CHECK(!v.read("[]{}"));
|
||||
BOOST_CHECK(!v.read("{}[]"));
|
||||
BOOST_CHECK(!v.read("{} 42"));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
univalue_constructor();
|
||||
univalue_typecheck();
|
||||
univalue_set();
|
||||
univalue_array();
|
||||
univalue_object();
|
||||
univalue_readwrite();
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
|
|
@ -0,0 +1 @@
|
|||
"abcdefghijklmnopqrstuvwxyz"
|
|
@ -0,0 +1 @@
|
|||
7
|
|
@ -0,0 +1 @@
|
|||
true
|
|
@ -0,0 +1 @@
|
|||
false
|
|
@ -0,0 +1 @@
|
|||
null
|
|
@ -0,0 +1,24 @@
|
|||
// Test program that can be called by the JSON test suite at
|
||||
// https://github.com/nst/JSONTestSuite.
|
||||
//
|
||||
// It reads JSON input from stdin and exits with code 0 if it can be parsed
|
||||
// successfully. It also pretty prints the parsed JSON value to stdout.
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include "univalue.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
UniValue val;
|
||||
if (val.read(string(istreambuf_iterator<char>(cin),
|
||||
istreambuf_iterator<char>()))) {
|
||||
cout << val.write(1 /* prettyIndent */, 4 /* indentLevel */) << endl;
|
||||
return 0;
|
||||
} else {
|
||||
cerr << "JSON Parse Error." << endl;
|
||||
return 1;
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright 2014 BitPay Inc.
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
// file COPYING or https://opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
@ -17,8 +17,7 @@
|
|||
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
string srcdir(JSON_TEST_SRC);
|
||||
std::string srcdir(JSON_TEST_SRC);
|
||||
static bool test_failed = false;
|
||||
|
||||
#define d_assert(expr) { if (!(expr)) { test_failed = true; fprintf(stderr, "%s failed\n", filename.c_str()); } }
|
||||
|
@ -30,9 +29,9 @@ static std::string rtrim(std::string s)
|
|||
return s;
|
||||
}
|
||||
|
||||
static void runtest(string filename, const string& jdata)
|
||||
static void runtest(std::string filename, const std::string& jdata)
|
||||
{
|
||||
string prefix = filename.substr(0, 4);
|
||||
std::string prefix = filename.substr(0, 4);
|
||||
|
||||
bool wantPass = (prefix == "pass") || (prefix == "roun");
|
||||
bool wantFail = (prefix == "fail");
|
||||
|
@ -56,19 +55,19 @@ static void runtest(string filename, const string& jdata)
|
|||
|
||||
static void runtest_file(const char *filename_)
|
||||
{
|
||||
string basename(filename_);
|
||||
string filename = srcdir + "/" + basename;
|
||||
std::string basename(filename_);
|
||||
std::string filename = srcdir + "/" + basename;
|
||||
FILE *f = fopen(filename.c_str(), "r");
|
||||
assert(f != NULL);
|
||||
assert(f != nullptr);
|
||||
|
||||
string jdata;
|
||||
std::string jdata;
|
||||
|
||||
char buf[4096];
|
||||
while (!feof(f)) {
|
||||
int bread = fread(buf, 1, sizeof(buf), f);
|
||||
assert(!ferror(f));
|
||||
|
||||
string s(buf, bread);
|
||||
std::string s(buf, bread);
|
||||
jdata += s;
|
||||
}
|
||||
|
||||
|
@ -113,6 +112,9 @@ static const char *filenames[] = {
|
|||
"fail39.json", // invalid unicode: only second half of surrogate pair
|
||||
"fail40.json", // invalid unicode: broken UTF-8
|
||||
"fail41.json", // invalid unicode: unfinished UTF-8
|
||||
"fail42.json", // valid json with garbage following a nul byte
|
||||
"fail44.json", // unterminated string
|
||||
"fail45.json", // nested beyond max depth
|
||||
"fail3.json",
|
||||
"fail4.json", // extra comma
|
||||
"fail5.json",
|
||||
|
@ -123,8 +125,14 @@ static const char *filenames[] = {
|
|||
"pass1.json",
|
||||
"pass2.json",
|
||||
"pass3.json",
|
||||
"pass4.json",
|
||||
"round1.json", // round-trip test
|
||||
"round2.json", // unicode
|
||||
"round3.json", // bare string
|
||||
"round4.json", // bare number
|
||||
"round5.json", // bare true
|
||||
"round6.json", // bare false
|
||||
"round7.json", // bare null
|
||||
};
|
||||
|
||||
// Test \u handling
|
||||
|
|
|
@ -60,25 +60,25 @@ void EnsureWalletIsUnlocked()
|
|||
void WalletTxToJSON(const CWalletTx& wtx, UniValue& entry)
|
||||
{
|
||||
int confirms = wtx.GetDepthInMainChain();
|
||||
entry.push_back(Pair("confirmations", confirms));
|
||||
entry.pushKV("confirmations", confirms);
|
||||
if (wtx.IsCoinBase())
|
||||
entry.push_back(Pair("generated", true));
|
||||
entry.pushKV("generated", true);
|
||||
if (confirms > 0)
|
||||
{
|
||||
entry.push_back(Pair("blockhash", wtx.hashBlock.GetHex()));
|
||||
entry.push_back(Pair("blockindex", wtx.nIndex));
|
||||
entry.push_back(Pair("blocktime", mapBlockIndex[wtx.hashBlock]->GetBlockTime()));
|
||||
entry.pushKV("blockhash", wtx.hashBlock.GetHex());
|
||||
entry.pushKV("blockindex", wtx.nIndex);
|
||||
entry.pushKV("blocktime", mapBlockIndex[wtx.hashBlock]->GetBlockTime());
|
||||
} else {
|
||||
entry.push_back(Pair("trusted", wtx.IsTrusted()));
|
||||
entry.pushKV("trusted", wtx.IsTrusted());
|
||||
}
|
||||
uint256 hash = wtx.GetHash();
|
||||
entry.push_back(Pair("txid", hash.GetHex()));
|
||||
entry.pushKV("txid", hash.GetHex());
|
||||
UniValue conflicts(UniValue::VARR);
|
||||
BOOST_FOREACH(const uint256& conflict, wtx.GetConflicts())
|
||||
conflicts.push_back(conflict.GetHex());
|
||||
entry.push_back(Pair("walletconflicts", conflicts));
|
||||
entry.push_back(Pair("time", wtx.GetTxTime()));
|
||||
entry.push_back(Pair("timereceived", (int64_t)wtx.nTimeReceived));
|
||||
entry.pushKV("walletconflicts", conflicts);
|
||||
entry.pushKV("time", wtx.GetTxTime());
|
||||
entry.pushKV("timereceived", (int64_t)wtx.nTimeReceived);
|
||||
|
||||
// Add opt-in RBF status
|
||||
std::string rbfStatus = "no";
|
||||
|
@ -90,10 +90,10 @@ void WalletTxToJSON(const CWalletTx& wtx, UniValue& entry)
|
|||
else if (rbfState == RBF_TRANSACTIONSTATE_REPLACEABLE_BIP125)
|
||||
rbfStatus = "yes";
|
||||
}
|
||||
entry.push_back(Pair("bip125-replaceable", rbfStatus));
|
||||
entry.pushKV("bip125-replaceable", rbfStatus);
|
||||
|
||||
BOOST_FOREACH(const PAIRTYPE(string,string)& item, wtx.mapValue)
|
||||
entry.push_back(Pair(item.first, item.second));
|
||||
entry.pushKV(item.first, item.second);
|
||||
}
|
||||
|
||||
string AccountFromValue(const UniValue& value)
|
||||
|
@ -1226,13 +1226,13 @@ UniValue ListReceived(const UniValue& params, bool fByAccounts)
|
|||
{
|
||||
UniValue obj(UniValue::VOBJ);
|
||||
if(fIsWatchonly)
|
||||
obj.push_back(Pair("involvesWatchonly", true));
|
||||
obj.push_back(Pair("address", address.ToString()));
|
||||
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.pushKV("involvesWatchonly", true);
|
||||
obj.pushKV("address", address.ToString());
|
||||
obj.pushKV("account", strAccount);
|
||||
obj.pushKV("amount", ValueFromAmount(nAmount));
|
||||
obj.pushKV("confirmations", (nConf == std::numeric_limits<int>::max() ? 0 : nConf));
|
||||
if (!fByAccounts)
|
||||
obj.push_back(Pair("label", strAccount));
|
||||
obj.pushKV("label", strAccount);
|
||||
UniValue transactions(UniValue::VARR);
|
||||
if (it != mapTally.end())
|
||||
{
|
||||
|
@ -1241,7 +1241,7 @@ UniValue ListReceived(const UniValue& params, bool fByAccounts)
|
|||
transactions.push_back(_item.GetHex());
|
||||
}
|
||||
}
|
||||
obj.push_back(Pair("txids", transactions));
|
||||
obj.pushKV("txids", transactions);
|
||||
ret.push_back(obj);
|
||||
}
|
||||
}
|
||||
|
@ -1254,10 +1254,10 @@ UniValue ListReceived(const UniValue& params, bool fByAccounts)
|
|||
int nConf = (*it).second.nConf;
|
||||
UniValue obj(UniValue::VOBJ);
|
||||
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.pushKV("involvesWatchonly", true);
|
||||
obj.pushKV("account", (*it).first);
|
||||
obj.pushKV("amount", ValueFromAmount(nAmount));
|
||||
obj.pushKV("confirmations", (nConf == std::numeric_limits<int>::max() ? 0 : nConf));
|
||||
ret.push_back(obj);
|
||||
}
|
||||
}
|
||||
|
@ -1348,7 +1348,7 @@ static void MaybePushAddress(UniValue & entry, const CTxDestination &dest)
|
|||
{
|
||||
CBitcoinAddress addr;
|
||||
if (addr.Set(dest))
|
||||
entry.push_back(Pair("address", addr.ToString()));
|
||||
entry.pushKV("address", addr.ToString());
|
||||
}
|
||||
|
||||
void ListTransactions(const CWalletTx& wtx, const string& strAccount, int nMinDepth, bool fLong, UniValue& ret, const isminefilter& filter)
|
||||
|
@ -1370,18 +1370,18 @@ void ListTransactions(const CWalletTx& wtx, const string& strAccount, int nMinDe
|
|||
{
|
||||
UniValue entry(UniValue::VOBJ);
|
||||
if(involvesWatchonly || (::IsMine(*pwalletMain, s.destination) & ISMINE_WATCH_ONLY))
|
||||
entry.push_back(Pair("involvesWatchonly", true));
|
||||
entry.push_back(Pair("account", strSentAccount));
|
||||
entry.pushKV("involvesWatchonly", true);
|
||||
entry.pushKV("account", strSentAccount);
|
||||
MaybePushAddress(entry, s.destination);
|
||||
entry.push_back(Pair("category", "send"));
|
||||
entry.push_back(Pair("amount", ValueFromAmount(-s.amount)));
|
||||
entry.pushKV("category", "send");
|
||||
entry.pushKV("amount", ValueFromAmount(-s.amount));
|
||||
if (pwalletMain->mapAddressBook.count(s.destination))
|
||||
entry.push_back(Pair("label", pwalletMain->mapAddressBook[s.destination].name));
|
||||
entry.push_back(Pair("vout", s.vout));
|
||||
entry.push_back(Pair("fee", ValueFromAmount(-nFee)));
|
||||
entry.pushKV("label", pwalletMain->mapAddressBook[s.destination].name);
|
||||
entry.pushKV("vout", s.vout);
|
||||
entry.pushKV("fee", ValueFromAmount(-nFee));
|
||||
if (fLong)
|
||||
WalletTxToJSON(wtx, entry);
|
||||
entry.push_back(Pair("abandoned", wtx.isAbandoned()));
|
||||
entry.pushKV("abandoned", wtx.isAbandoned());
|
||||
ret.push_back(entry);
|
||||
}
|
||||
}
|
||||
|
@ -1398,26 +1398,26 @@ void ListTransactions(const CWalletTx& wtx, const string& strAccount, int nMinDe
|
|||
{
|
||||
UniValue entry(UniValue::VOBJ);
|
||||
if(involvesWatchonly || (::IsMine(*pwalletMain, r.destination) & ISMINE_WATCH_ONLY))
|
||||
entry.push_back(Pair("involvesWatchonly", true));
|
||||
entry.push_back(Pair("account", account));
|
||||
entry.pushKV("involvesWatchonly", true);
|
||||
entry.pushKV("account", account);
|
||||
MaybePushAddress(entry, r.destination);
|
||||
if (wtx.IsCoinBase())
|
||||
{
|
||||
if (wtx.GetDepthInMainChain() < 1)
|
||||
entry.push_back(Pair("category", "orphan"));
|
||||
entry.pushKV("category", "orphan");
|
||||
else if (wtx.GetBlocksToMaturity() > 0)
|
||||
entry.push_back(Pair("category", "immature"));
|
||||
entry.pushKV("category", "immature");
|
||||
else
|
||||
entry.push_back(Pair("category", "generate"));
|
||||
entry.pushKV("category", "generate");
|
||||
}
|
||||
else
|
||||
{
|
||||
entry.push_back(Pair("category", "receive"));
|
||||
entry.pushKV("category", "receive");
|
||||
}
|
||||
entry.push_back(Pair("amount", ValueFromAmount(r.amount)));
|
||||
entry.pushKV("amount", ValueFromAmount(r.amount));
|
||||
if (pwalletMain->mapAddressBook.count(r.destination))
|
||||
entry.push_back(Pair("label", account));
|
||||
entry.push_back(Pair("vout", r.vout));
|
||||
entry.pushKV("label", account);
|
||||
entry.pushKV("vout", r.vout);
|
||||
if (fLong)
|
||||
WalletTxToJSON(wtx, entry);
|
||||
ret.push_back(entry);
|
||||
|
@ -1433,12 +1433,12 @@ void AcentryToJSON(const CAccountingEntry& acentry, const string& strAccount, Un
|
|||
if (fAllAccounts || acentry.strAccount == strAccount)
|
||||
{
|
||||
UniValue entry(UniValue::VOBJ);
|
||||
entry.push_back(Pair("account", acentry.strAccount));
|
||||
entry.push_back(Pair("category", "move"));
|
||||
entry.push_back(Pair("time", acentry.nTime));
|
||||
entry.push_back(Pair("amount", ValueFromAmount(acentry.nCreditDebit)));
|
||||
entry.push_back(Pair("otheraccount", acentry.strOtherAccount));
|
||||
entry.push_back(Pair("comment", acentry.strComment));
|
||||
entry.pushKV("account", acentry.strAccount);
|
||||
entry.pushKV("category", "move");
|
||||
entry.pushKV("time", acentry.nTime);
|
||||
entry.pushKV("amount", ValueFromAmount(acentry.nCreditDebit));
|
||||
entry.pushKV("otheraccount", acentry.strOtherAccount);
|
||||
entry.pushKV("comment", acentry.strComment);
|
||||
ret.push_back(entry);
|
||||
}
|
||||
}
|
||||
|
@ -1645,7 +1645,7 @@ UniValue listaccounts(const JSONRPCRequest& request)
|
|||
|
||||
UniValue ret(UniValue::VOBJ);
|
||||
BOOST_FOREACH(const PAIRTYPE(string, CAmount)& accountBalance, mapAccountBalances) {
|
||||
ret.push_back(Pair(accountBalance.first, ValueFromAmount(accountBalance.second)));
|
||||
ret.pushKV(accountBalance.first, ValueFromAmount(accountBalance.second));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -1750,8 +1750,8 @@ UniValue listsinceblock(const JSONRPCRequest& request)
|
|||
uint256 lastblock = pblockLast ? pblockLast->GetBlockHash() : uint256();
|
||||
|
||||
UniValue ret(UniValue::VOBJ);
|
||||
ret.push_back(Pair("transactions", transactions));
|
||||
ret.push_back(Pair("lastblock", lastblock.GetHex()));
|
||||
ret.pushKV("transactions", transactions);
|
||||
ret.pushKV("lastblock", lastblock.GetHex());
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -1826,18 +1826,18 @@ UniValue gettransaction(const JSONRPCRequest& request)
|
|||
CAmount nNet = nCredit - nDebit;
|
||||
CAmount nFee = (wtx.IsFromMe(filter) ? wtx.tx->GetValueOut() - nDebit : 0);
|
||||
|
||||
entry.push_back(Pair("amount", ValueFromAmount(nNet - nFee)));
|
||||
entry.pushKV("amount", ValueFromAmount(nNet - nFee));
|
||||
if (wtx.IsFromMe(filter))
|
||||
entry.push_back(Pair("fee", ValueFromAmount(nFee)));
|
||||
entry.pushKV("fee", ValueFromAmount(nFee));
|
||||
|
||||
WalletTxToJSON(wtx, entry);
|
||||
|
||||
UniValue details(UniValue::VARR);
|
||||
ListTransactions(wtx, "*", 0, false, details, filter);
|
||||
entry.push_back(Pair("details", details));
|
||||
entry.pushKV("details", details);
|
||||
|
||||
string strHex = EncodeHexTx(static_cast<CTransaction>(wtx), RPCSerializationFlags());
|
||||
entry.push_back(Pair("hex", strHex));
|
||||
entry.pushKV("hex", strHex);
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
@ -2279,8 +2279,8 @@ UniValue listlockunspent(const JSONRPCRequest& request)
|
|||
BOOST_FOREACH(COutPoint &outpt, vOutpts) {
|
||||
UniValue o(UniValue::VOBJ);
|
||||
|
||||
o.push_back(Pair("txid", outpt.hash.GetHex()));
|
||||
o.push_back(Pair("vout", (int)outpt.n));
|
||||
o.pushKV("txid", outpt.hash.GetHex());
|
||||
o.pushKV("vout", (int)outpt.n);
|
||||
ret.push_back(o);
|
||||
}
|
||||
|
||||
|
@ -2344,19 +2344,19 @@ UniValue getwalletinfo(const JSONRPCRequest& request)
|
|||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
UniValue obj(UniValue::VOBJ);
|
||||
obj.push_back(Pair("walletversion", pwalletMain->GetVersion()));
|
||||
obj.push_back(Pair("balance", ValueFromAmount(pwalletMain->GetBalance())));
|
||||
obj.push_back(Pair("unconfirmed_balance", ValueFromAmount(pwalletMain->GetUnconfirmedBalance())));
|
||||
obj.push_back(Pair("immature_balance", ValueFromAmount(pwalletMain->GetImmatureBalance())));
|
||||
obj.push_back(Pair("txcount", (int)pwalletMain->mapWallet.size()));
|
||||
obj.push_back(Pair("keypoololdest", pwalletMain->GetOldestKeyPoolTime()));
|
||||
obj.push_back(Pair("keypoolsize", (int)pwalletMain->GetKeyPoolSize()));
|
||||
obj.pushKV("walletversion", pwalletMain->GetVersion());
|
||||
obj.pushKV("balance", ValueFromAmount(pwalletMain->GetBalance()));
|
||||
obj.pushKV("unconfirmed_balance", ValueFromAmount(pwalletMain->GetUnconfirmedBalance()));
|
||||
obj.pushKV("immature_balance", ValueFromAmount(pwalletMain->GetImmatureBalance()));
|
||||
obj.pushKV("txcount", (int)pwalletMain->mapWallet.size());
|
||||
obj.pushKV("keypoololdest", pwalletMain->GetOldestKeyPoolTime());
|
||||
obj.pushKV("keypoolsize", (int)pwalletMain->GetKeyPoolSize());
|
||||
if (pwalletMain->IsCrypted())
|
||||
obj.push_back(Pair("unlocked_until", nWalletUnlockTime));
|
||||
obj.push_back(Pair("paytxfee", ValueFromAmount(payTxFee.GetFeePerK())));
|
||||
obj.pushKV("unlocked_until", nWalletUnlockTime);
|
||||
obj.pushKV("paytxfee", ValueFromAmount(payTxFee.GetFeePerK()));
|
||||
CKeyID masterKeyID = pwalletMain->GetHDChain().masterKeyID;
|
||||
if (!masterKeyID.IsNull())
|
||||
obj.push_back(Pair("hdmasterkeyid", masterKeyID.GetHex()));
|
||||
obj.pushKV("hdmasterkeyid", masterKeyID.GetHex());
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
@ -2512,28 +2512,28 @@ UniValue listunspent(const JSONRPCRequest& request)
|
|||
continue;
|
||||
|
||||
UniValue entry(UniValue::VOBJ);
|
||||
entry.push_back(Pair("txid", out.tx->GetHash().GetHex()));
|
||||
entry.push_back(Pair("vout", out.i));
|
||||
entry.pushKV("txid", out.tx->GetHash().GetHex());
|
||||
entry.pushKV("vout", out.i);
|
||||
|
||||
if (fValidAddress) {
|
||||
entry.push_back(Pair("address", CBitcoinAddress(address).ToString()));
|
||||
entry.pushKV("address", CBitcoinAddress(address).ToString());
|
||||
|
||||
if (pwalletMain->mapAddressBook.count(address))
|
||||
entry.push_back(Pair("account", pwalletMain->mapAddressBook[address].name));
|
||||
entry.pushKV("account", pwalletMain->mapAddressBook[address].name);
|
||||
|
||||
if (scriptPubKey.IsPayToScriptHash()) {
|
||||
const CScriptID& hash = boost::get<CScriptID>(address);
|
||||
CScript redeemScript;
|
||||
if (pwalletMain->GetCScript(hash, redeemScript))
|
||||
entry.push_back(Pair("redeemScript", HexStr(redeemScript.begin(), redeemScript.end())));
|
||||
entry.pushKV("redeemScript", HexStr(redeemScript.begin(), redeemScript.end()));
|
||||
}
|
||||
}
|
||||
|
||||
entry.push_back(Pair("scriptPubKey", HexStr(scriptPubKey.begin(), scriptPubKey.end())));
|
||||
entry.push_back(Pair("amount", ValueFromAmount(out.tx->tx->vout[out.i].nValue)));
|
||||
entry.push_back(Pair("confirmations", out.nDepth));
|
||||
entry.push_back(Pair("spendable", out.fSpendable));
|
||||
entry.push_back(Pair("solvable", out.fSolvable));
|
||||
entry.pushKV("scriptPubKey", HexStr(scriptPubKey.begin(), scriptPubKey.end()));
|
||||
entry.pushKV("amount", ValueFromAmount(out.tx->tx->vout[out.i].nValue));
|
||||
entry.pushKV("confirmations", out.nDepth);
|
||||
entry.pushKV("spendable", out.fSpendable);
|
||||
entry.pushKV("solvable", out.fSolvable);
|
||||
results.push_back(entry);
|
||||
}
|
||||
|
||||
|
@ -2688,9 +2688,9 @@ UniValue fundrawtransaction(const JSONRPCRequest& request)
|
|||
throw JSONRPCError(RPC_WALLET_ERROR, strFailReason);
|
||||
|
||||
UniValue result(UniValue::VOBJ);
|
||||
result.push_back(Pair("hex", EncodeHexTx(tx)));
|
||||
result.push_back(Pair("changepos", changePosition));
|
||||
result.push_back(Pair("fee", ValueFromAmount(nFeeOut)));
|
||||
result.pushKV("hex", EncodeHexTx(tx));
|
||||
result.pushKV("changepos", changePosition);
|
||||
result.pushKV("fee", ValueFromAmount(nFeeOut));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -3008,10 +3008,10 @@ UniValue bumpfee(const JSONRPCRequest& request)
|
|||
}
|
||||
|
||||
UniValue result(UniValue::VOBJ);
|
||||
result.push_back(Pair("txid", wtxBumped.GetHash().GetHex()));
|
||||
result.push_back(Pair("origfee", ValueFromAmount(nOldFee)));
|
||||
result.push_back(Pair("fee", ValueFromAmount(nNewFee)));
|
||||
result.push_back(Pair("errors", vErrors));
|
||||
result.pushKV("txid", wtxBumped.GetHash().GetHex());
|
||||
result.pushKV("origfee", ValueFromAmount(nOldFee));
|
||||
result.pushKV("fee", ValueFromAmount(nNewFee));
|
||||
result.pushKV("errors", vErrors);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue