Browse Source

test

etomic
jl777 8 years ago
parent
commit
1674e50ca0
  1. 6
      iguana/iguana_payments.c
  2. 12
      iguana/ramchain_api.c

6
iguana/iguana_payments.c

@ -605,6 +605,8 @@ STRING_AND_INT(bitcoinrpc,sendrawtransaction,rawtx,allowhighfees)
cJSON *retjson = cJSON_CreateObject(); bits256 txid; cJSON *retjson = cJSON_CreateObject(); bits256 txid;
if ( remoteaddr != 0 ) if ( remoteaddr != 0 )
return(clonestr("{\"error\":\"no remote\"}")); return(clonestr("{\"error\":\"no remote\"}"));
if ( coin->notarychain >= 0 && coin->FULLNODE == 0 )
return(_dex_sendrawtransaction(myinfo,coin->symbol,rawtx));
txid = iguana_sendrawtransaction(myinfo,coin,rawtx); txid = iguana_sendrawtransaction(myinfo,coin,rawtx);
jaddbits256(retjson,"result",txid); jaddbits256(retjson,"result",txid);
return(jprint(retjson,1)); return(jprint(retjson,1));
@ -764,6 +766,8 @@ HASH_AND_TWOINTS(bitcoinrpc,gettxout,txid,vout,mempool)
return(clonestr("{\"error\":\"no remote\"}")); return(clonestr("{\"error\":\"no remote\"}"));
if ( coin != 0 ) if ( coin != 0 )
{ {
if ( coin->notarychain >= 0 && coin->FULLNODE == 0 )
return(_dex_gettxout(myinfo,coin->symbol,txid,vout));
if ( (value= _RTgettxout(coin,&ptr,&height,&scriptlen,script,rmd160,coinaddr,txid,vout,mempool)) > 0 ) if ( (value= _RTgettxout(coin,&ptr,&height,&scriptlen,script,rmd160,coinaddr,txid,vout,mempool)) > 0 )
{ {
jaddbits256(retjson,"bestblock",coin->blocks.hwmchain.RO.hash2); jaddbits256(retjson,"bestblock",coin->blocks.hwmchain.RO.hash2);
@ -958,6 +962,8 @@ HASH_AND_INT(bitcoinrpc,getrawtransaction,txid,verbose)
struct iguana_txid *tx,T; char *txbytes; bits256 checktxid; int32_t len=0,height,extralen=65536; cJSON *retjson,*txobj; uint8_t *extraspace; struct iguana_RTtxid *RTptr; struct iguana_txid *tx,T; char *txbytes; bits256 checktxid; int32_t len=0,height,extralen=65536; cJSON *retjson,*txobj; uint8_t *extraspace; struct iguana_RTtxid *RTptr;
if ( remoteaddr != 0 ) if ( remoteaddr != 0 )
return(clonestr("{\"error\":\"no remote\"}")); return(clonestr("{\"error\":\"no remote\"}"));
if ( coin->notarychain >= 0 && coin->FULLNODE == 0 )
return(_dex_getrawtransaction(myinfo,coin->symbol,txid));
HASH_FIND(hh,coin->RTdataset,txid.bytes,sizeof(txid),RTptr); HASH_FIND(hh,coin->RTdataset,txid.bytes,sizeof(txid),RTptr);
if ( RTptr != 0 && RTptr->rawtxbytes != 0 && RTptr->txlen > 0 ) if ( RTptr != 0 && RTptr->rawtxbytes != 0 && RTptr->txlen > 0 )
{ {

12
iguana/ramchain_api.c

@ -114,7 +114,10 @@ STRING_ARG(iguana,removecoin,activecoin)
INT_ARG(bitcoinrpc,getblockhash,height) INT_ARG(bitcoinrpc,getblockhash,height)
{ {
cJSON *retjson = cJSON_CreateObject(); cJSON *retjson;
if ( coin->notarychain >= 0 && coin->FULLNODE == 0 )
return(_dex_getblockhash(myinfo,coin->symbol,height));
retjson = cJSON_CreateObject();
jaddbits256(retjson,"result",iguana_blockhash(coin,height)); jaddbits256(retjson,"result",iguana_blockhash(coin,height));
return(jprint(retjson,1)); return(jprint(retjson,1));
} }
@ -122,6 +125,8 @@ INT_ARG(bitcoinrpc,getblockhash,height)
HASH_AND_TWOINTS(bitcoinrpc,getblock,blockhash,verbose,remoteonly) HASH_AND_TWOINTS(bitcoinrpc,getblock,blockhash,verbose,remoteonly)
{ {
char *blockstr,*datastr; struct iguana_msgblock msg; struct iguana_block *block; cJSON *retjson; bits256 txid; int32_t len; char *blockstr,*datastr; struct iguana_msgblock msg; struct iguana_block *block; cJSON *retjson; bits256 txid; int32_t len;
if ( coin->notarychain >= 0 && coin->FULLNODE == 0 )
return(_dex_getblock(myinfo,coin->symbol,blockhash));
retjson = cJSON_CreateObject(); retjson = cJSON_CreateObject();
memset(&msg,0,sizeof(msg)); memset(&msg,0,sizeof(msg));
if ( remoteonly == 0 && (block= iguana_blockfind("getblockRPC",coin,blockhash)) != 0 ) if ( remoteonly == 0 && (block= iguana_blockfind("getblockRPC",coin,blockhash)) != 0 )
@ -157,7 +162,10 @@ HASH_AND_TWOINTS(bitcoinrpc,getblock,blockhash,verbose,remoteonly)
ZERO_ARGS(bitcoinrpc,getbestblockhash) ZERO_ARGS(bitcoinrpc,getbestblockhash)
{ {
cJSON *retjson = cJSON_CreateObject(); cJSON *retjson;
if ( coin->notarychain >= 0 && coin->FULLNODE == 0 )
return(_dex_getbestblockhash(myinfo,coin->symbol));
retjson = cJSON_CreateObject();
char str[65]; jaddstr(retjson,"result",bits256_str(str,coin->blocks.hwmchain.RO.hash2)); char str[65]; jaddstr(retjson,"result",bits256_str(str,coin->blocks.hwmchain.RO.hash2));
return(jprint(retjson,1)); return(jprint(retjson,1));
} }

Loading…
Cancel
Save