add rpc to return pubkey
This commit is contained in:
@@ -257,18 +257,6 @@ UniValue blockToDeltasJSON(const CBlock& block, const CBlockIndex* blockindex)
|
||||
return result;
|
||||
}
|
||||
|
||||
void voutToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry)
|
||||
{
|
||||
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("hex", HexStr(txout.scriptPubKey.begin(), txout.scriptPubKey.end())));
|
||||
vout.push_back(out);
|
||||
}
|
||||
entry.push_back(Pair("vout", vout));
|
||||
}
|
||||
|
||||
UniValue getdatafromblock(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (fHelp || params.size() < 1 || params.size() > 2)
|
||||
@@ -335,18 +323,20 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp)
|
||||
UniValue result(UniValue::VARR);
|
||||
unsigned int i = 0;
|
||||
fprintf(stderr, "number of tx in block: %ld\n", block.vtx.size());
|
||||
// Iif block tx size is > 2 then we can do this
|
||||
BOOST_FOREACH(const CTransaction&tx, block.vtx)
|
||||
{
|
||||
//if the vout size = 3 then its a valid TX get the data. dont use the test here! it wont work with notarisations!
|
||||
if ( (i == 0) || (i == (block.vtx.size() -1)) )
|
||||
{
|
||||
fprintf(stderr, "skipped tx number: %d \n",i);
|
||||
} else {
|
||||
fprintf(stderr, "added tx number: %d \n",i);
|
||||
UniValue objTx(UniValue::VOBJ);
|
||||
//voutToJSON(tx, uint256(), objTx);
|
||||
//const CTxOut& txout = tx.vout[i];
|
||||
//UniValue out(UniValue::VOBJ);
|
||||
|
||||
objTx.push_back(Pair("hex", HexStr(tx.vout[2].scriptPubKey.begin(), tx.vout[2].scriptPubKey.end())));
|
||||
// function here to extract seqid from first and last TX
|
||||
// we an push the data or not depending on input from RPC.
|
||||
result.push_back(objTx);
|
||||
}
|
||||
i = i + 1;
|
||||
|
||||
@@ -264,6 +264,7 @@ static const CRPCCommand vRPCCommands[] =
|
||||
{ "control", "getinfo", &getinfo, true }, /* uses wallet if enabled */
|
||||
{ "control", "help", &help, true },
|
||||
{ "control", "stop", &stop, true },
|
||||
{ "control", "getpubkey", &getpubkey, true },
|
||||
|
||||
/* P2P networking */
|
||||
{ "network", "getnetworkinfo", &getnetworkinfo, true },
|
||||
|
||||
@@ -322,6 +322,7 @@ extern UniValue walletlock(const UniValue& params, bool fHelp);
|
||||
extern UniValue encryptwallet(const UniValue& params, bool fHelp);
|
||||
extern UniValue validateaddress(const UniValue& params, bool fHelp);
|
||||
extern UniValue getinfo(const UniValue& params, bool fHelp);
|
||||
extern UniValue getpubkey(const UniValue& params, bool fHelp);
|
||||
extern UniValue getwalletinfo(const UniValue& params, bool fHelp);
|
||||
extern UniValue getblockchaininfo(const UniValue& params, bool fHelp);
|
||||
extern UniValue getnetworkinfo(const UniValue& params, bool fHelp);
|
||||
|
||||
@@ -4953,6 +4953,35 @@ UniValue channelsaddress(const UniValue& params, bool fHelp)
|
||||
return(result);
|
||||
}
|
||||
|
||||
UniValue getpubkey(const UniValue& params, bool fHelp)
|
||||
{
|
||||
UniValue result(UniValue::VOBJ);
|
||||
if (fHelp || params.size() > 0)
|
||||
throw runtime_error(
|
||||
"getpubkey\n"
|
||||
"\nReturns the -pubkey the daemon was started with.\n"
|
||||
"\nResult:\n"
|
||||
"[\n"
|
||||
" {\n"
|
||||
" \"pubkey\" : \"pubkey\", (string) The pubkey\n"
|
||||
" }\n"
|
||||
"]\n"
|
||||
"\nExamples:\n"
|
||||
"\nList pubkey.\n"
|
||||
+ HelpExampleCli("getpubkey", "")
|
||||
+ HelpExampleRpc("getpubkey", "")
|
||||
);
|
||||
|
||||
extern uint8_t NOTARY_PUBKEY33[];
|
||||
extern std::string NOTARY_PUBKEY;
|
||||
if ( NOTARY_PUBKEY33[0] == 0 ) {
|
||||
result.push_back(Pair("error","pubkey was not set!";
|
||||
} else {
|
||||
result.push_back(Pair("pubkey", NOTARY_PUBKEY);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
UniValue oraclesaddress(const UniValue& params, bool fHelp)
|
||||
{
|
||||
struct CCcontract_info *cp,C; std::vector<unsigned char> pubkey;
|
||||
|
||||
Reference in New Issue
Block a user