Cleanup
This commit is contained in:
@@ -616,19 +616,19 @@ int32_t hush_is_issuer();
|
||||
int32_t dragon_rwnum(int32_t rwflag,uint8_t *serialized,int32_t len,void *endianedp);
|
||||
int32_t hush_isrealtime(int32_t *kmdheightp);
|
||||
int32_t pax_fiatstatus(uint64_t *available,uint64_t *deposited,uint64_t *issued,uint64_t *withdrawn,uint64_t *approved,uint64_t *redeemed,char *base);
|
||||
int32_t komodo_kvsearch(uint256 *refpubkeyp,int32_t current_height,uint32_t *flagsp,int32_t *heightp,uint8_t value[DRAGON_MAXSCRIPTSIZE],uint8_t *key,int32_t keylen);
|
||||
int32_t komodo_kvcmp(uint8_t *refvalue,uint16_t refvaluesize,uint8_t *value,uint16_t valuesize);
|
||||
uint64_t komodo_kvfee(uint32_t flags,int32_t opretlen,int32_t keylen);
|
||||
uint256 komodo_kvsig(uint8_t *buf,int32_t len,uint256 privkey);
|
||||
int32_t komodo_kvduration(uint32_t flags);
|
||||
uint256 komodo_kvprivkey(uint256 *pubkeyp,char *passphrase);
|
||||
int32_t komodo_kvsigverify(uint8_t *buf,int32_t len,uint256 _pubkey,uint256 sig);
|
||||
int32_t hush_kvsearch(uint256 *refpubkeyp,int32_t current_height,uint32_t *flagsp,int32_t *heightp,uint8_t value[DRAGON_MAXSCRIPTSIZE],uint8_t *key,int32_t keylen);
|
||||
int32_t hush_kvcmp(uint8_t *refvalue,uint16_t refvaluesize,uint8_t *value,uint16_t valuesize);
|
||||
uint64_t hush_kvfee(uint32_t flags,int32_t opretlen,int32_t keylen);
|
||||
uint256 hush_kvsig(uint8_t *buf,int32_t len,uint256 privkey);
|
||||
int32_t hush_kvduration(uint32_t flags);
|
||||
uint256 hush_kvprivkey(uint256 *pubkeyp,char *passphrase);
|
||||
int32_t hush_kvsigverify(uint8_t *buf,int32_t len,uint256 _pubkey,uint256 sig);
|
||||
|
||||
UniValue kvupdate(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
{
|
||||
static uint256 zeroes;
|
||||
CWalletTx wtx; UniValue ret(UniValue::VOBJ);
|
||||
uint8_t keyvalue[DRAGON_MAXSCRIPTSIZE*8],opretbuf[DRAGON_MAXSCRIPTSIZE*8]; int32_t i,coresize,haveprivkey,duration,opretlen,height; uint16_t keylen=0,valuesize=0,refvaluesize=0; uint8_t *key,*value=0; uint32_t flags,tmpflags,n; struct komodo_kv *ptr; uint64_t fee; uint256 privkey,pubkey,refpubkey,sig;
|
||||
uint8_t keyvalue[DRAGON_MAXSCRIPTSIZE*8],opretbuf[DRAGON_MAXSCRIPTSIZE*8]; int32_t i,coresize,haveprivkey,duration,opretlen,height; uint16_t keylen=0,valuesize=0,refvaluesize=0; uint8_t *key,*value=0; uint32_t flags,tmpflags,n; struct hush_kv *ptr; uint64_t fee; uint256 privkey,pubkey,refpubkey,sig;
|
||||
if (fHelp || params.size() < 3 )
|
||||
throw runtime_error(
|
||||
"kvupdate key \"value\" days passphrase\n"
|
||||
@@ -670,7 +670,7 @@ UniValue kvupdate(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
//printf("flags.%d (%s) n.%d\n",flags,params[2].get_str().c_str(),n);
|
||||
} else flags = 0;
|
||||
if ( n >= 4 )
|
||||
privkey = komodo_kvprivkey(&pubkey,(char *)(n >= 4 ? params[3].get_str().c_str() : "password"));
|
||||
privkey = hush_kvprivkey(&pubkey,(char *)(n >= 4 ? params[3].get_str().c_str() : "password"));
|
||||
haveprivkey = 1;
|
||||
flags |= 1;
|
||||
/*for (i=0; i<32; i++)
|
||||
@@ -690,7 +690,7 @@ UniValue kvupdate(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
valuesize = (int32_t)strlen(params[1].get_str().c_str());
|
||||
}
|
||||
memcpy(keyvalue,key,keylen);
|
||||
if ( (refvaluesize= komodo_kvsearch(&refpubkey,chainActive.LastTip()->GetHeight(),&tmpflags,&height,&keyvalue[keylen],key,keylen)) >= 0 )
|
||||
if ( (refvaluesize= hush_kvsearch(&refpubkey,chainActive.LastTip()->GetHeight(),&tmpflags,&height,&keyvalue[keylen],key,keylen)) >= 0 )
|
||||
{
|
||||
if ( (tmpflags & HUSH_KVPROTECTED) != 0 )
|
||||
{
|
||||
@@ -702,8 +702,8 @@ UniValue kvupdate(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
}
|
||||
if ( keylen+refvaluesize <= sizeof(keyvalue) )
|
||||
{
|
||||
sig = komodo_kvsig(keyvalue,keylen+refvaluesize,privkey);
|
||||
if ( komodo_kvsigverify(keyvalue,keylen+refvaluesize,refpubkey,sig) < 0 )
|
||||
sig = hush_kvsig(keyvalue,keylen+refvaluesize,privkey);
|
||||
if ( hush_kvsigverify(keyvalue,keylen+refvaluesize,refpubkey,sig) < 0 )
|
||||
{
|
||||
ret.push_back(Pair("error",(char *)"error verifying sig, passphrase is probably wrong"));
|
||||
printf("VERIFY ERROR\n");
|
||||
@@ -719,7 +719,7 @@ UniValue kvupdate(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
if ( memcmp(&zeroes,&refpubkey,sizeof(refpubkey)) != 0 )
|
||||
ret.push_back(Pair("owner",refpubkey.GetHex()));
|
||||
ret.push_back(Pair("height", (int64_t)height));
|
||||
duration = komodo_kvduration(flags); //((flags >> 2) + 1) * HUSH_KVDURATION;
|
||||
duration = hush_kvduration(flags); //((flags >> 2) + 1) * HUSH_KVDURATION;
|
||||
ret.push_back(Pair("expiration", (int64_t)(height+duration)));
|
||||
ret.push_back(Pair("flags",(int64_t)flags));
|
||||
ret.push_back(Pair("key",params[0].get_str()));
|
||||
@@ -755,7 +755,7 @@ UniValue kvupdate(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
// printf("%02x",opretbuf[i]);
|
||||
//printf(" opretbuf keylen.%d valuesize.%d height.%d (%02x %02x %02x)\n",*(uint16_t *)&keyvalue[0],*(uint16_t *)&keyvalue[2],*(uint32_t *)&keyvalue[4],keyvalue[8],keyvalue[9],keyvalue[10]);
|
||||
EnsureWalletIsUnlocked();
|
||||
fee = komodo_kvfee(flags,opretlen,keylen);
|
||||
fee = hush_kvfee(flags,opretlen,keylen);
|
||||
ret.push_back(Pair("fee",(double)fee/COIN));
|
||||
CBitcoinAddress destaddress(CRYPTO555_HUSHADDR);
|
||||
if (!destaddress.IsValid())
|
||||
|
||||
Reference in New Issue
Block a user