|
|
@ -833,13 +833,23 @@ THREE_STRINGS(bitcoinrpc,verifymessage,address,sig,message) |
|
|
|
|
|
|
|
HASH_AND_INT(bitcoinrpc,getrawtransaction,txid,verbose) |
|
|
|
{ |
|
|
|
struct iguana_txid *tx,T; char *txbytes; bits256 checktxid; int32_t len,height,extralen=65536; cJSON *retjson,*txobj; uint8_t *extraspace; struct iguana_block *block; bits256 hash2; |
|
|
|
struct iguana_txid *tx,T; char *txbytes; bits256 checktxid; int32_t len=0,height,extralen=65536; cJSON *retjson,*txobj; uint8_t *extraspace; struct iguana_block *block; bits256 hash2; struct iguana_RTtxid *RTptr; |
|
|
|
if ( remoteaddr != 0 ) |
|
|
|
return(clonestr("{\"error\":\"no remote\"}")); |
|
|
|
if ( (tx= iguana_txidfind(coin,&height,&T,txid,coin->bundlescount-1)) != 0 ) |
|
|
|
HASH_FIND(hh,coin->RTdataset,txid.bytes,sizeof(txid),RTptr); |
|
|
|
if ( RTptr != 0 && RTptr->rawtxbytes != 0 && RTptr->txlen > 0 ) |
|
|
|
{ |
|
|
|
checktxid = RTptr->txid; |
|
|
|
height = RTptr->height; |
|
|
|
len = RTptr->txlen; |
|
|
|
memcpy(coin->blockspace,RTptr->rawtxbytes,len); |
|
|
|
} |
|
|
|
else if ( (tx= iguana_txidfind(coin,&height,&T,txid,coin->bundlescount-1)) != 0 ) |
|
|
|
{ |
|
|
|
len = iguana_ramtxbytes(coin,coin->blockspace,coin->blockspacesize,&checktxid,tx,height,0,0,0); |
|
|
|
} |
|
|
|
retjson = cJSON_CreateObject(); |
|
|
|
if ( (len= iguana_ramtxbytes(coin,coin->blockspace,coin->blockspacesize,&checktxid,tx,height,0,0,0)) > 0 ) |
|
|
|
if ( len > 0 ) |
|
|
|
{ |
|
|
|
txbytes = calloc(1,len*2+1); |
|
|
|
init_hexbytes_noT(txbytes,coin->blockspace,len); |
|
|
@ -890,7 +900,6 @@ HASH_AND_INT(bitcoinrpc,getrawtransaction,txid,verbose) |
|
|
|
} else jaddstr(retjson,"error","cant find blockhash"); |
|
|
|
return(jprint(retjson,1)); |
|
|
|
} |
|
|
|
} else printf("height.%d\n",height); |
|
|
|
} |
|
|
|
return(clonestr("{\"error\":\"cant find txid\"}")); |
|
|
|
} |
|
|
|