Skip to content

Commit

Permalink
help fn, fix
Browse files Browse the repository at this point in the history
  • Loading branch information
quarkonium committed Dec 4, 2017
1 parent 8ede17b commit ebb4a2b
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/bitcoinrpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ static const CRPCCommand vRPCCommands[] =
{ "getnumblocksofpeers", &getnumblocksofpeers, true, false },
{ "getpeerinfo", &getpeerinfo, true, false },
{ "getdifficulty", &getdifficulty, true, false },
{ "gw1", &gw1, true, false },
{ "getnetworkmhashps", &getnetworkmhashps, true, false },
{ "getinfo", &getinfo, true, false },
{ "getsubsidy", &getsubsidy, true, false },
Expand Down
1 change: 1 addition & 0 deletions src/bitcoinrpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ extern std::vector<unsigned char> ParseHexO(const json_spirit::Object& o, std::s
extern json_spirit::Value getnumblocksofpeers(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value getconnectioncount(const json_spirit::Array& params, bool fHelp); // in rpcnet.cpp
extern json_spirit::Value getpeerinfo(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value gw1(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value dumpwallet(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value importwallet(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value dumpprivkey(const json_spirit::Array& params, bool fHelp); // in rpcdump.cpp
Expand Down
63 changes: 63 additions & 0 deletions src/dions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,69 @@ bool channelPredicate(string ext, string& tor)

return true;
}
Value gw1(const Array& params, bool fHelp)
{
Array oRes;
LocatorNodeDB ln1Db("r");

Dbc* cursorp;
try
{
cursorp = ln1Db.GetCursor();

Dbt key, data;
int ret;

while ((ret = cursorp->get(&key, &data, DB_NEXT)) == 0)
{
printf(" key \n");
CDataStream ssKey(SER_DISK, CLIENT_VERSION);
ssKey.write((char*)key.get_data(), key.get_size());

string k1;
ssKey >> k1;
if(k1 == "alias_")
{
Object o;
printf(" k1 %s\n", k1.c_str());
vchType k2;
ssKey >> k2;
string a = stringFromVch(k2);
printf(" k2 %s\n", a.c_str());
o.push_back(Pair("alias", a));
oRes.push_back(o);

vector<AliasIndex> vtxPos;
CDataStream ssValue((char*)data.get_data(), (char*)data.get_data() + data.get_size(), SER_DISK, CLIENT_VERSION);
ssValue >> vtxPos;

AliasIndex i = vtxPos.back();
string i_address = (i.vAddress).c_str();
printf(" vAddress %s\n", i_address.c_str());
}
}
if (ret != DB_NOTFOUND)
{
// ret should be DB_NOTFOUND upon exiting the loop.
// Dbc::get() will by default throw an exception if any
// significant errors occur, so by default this if block
// can never be reached.
}
}
catch(DbException &e)
{
//ln1Db.err(e.get_errno(), "Error!");
}
catch(std::exception &e)
{
//ln1Db.errx("Error! %s", e.what());
}

if (cursorp != NULL)
cursorp->close();

return oRes;
}
bool channel(string l, string f, string& k, bool& black)
{
vchType rVch;
Expand Down

0 comments on commit ebb4a2b

Please sign in to comment.