This commit is contained in:
blackjok3r
2018-10-25 10:32:55 +08:00
parent e42dcb0474
commit be21e25e56

View File

@@ -257,10 +257,14 @@ UniValue blockToDeltasJSON(const CBlock& block, const CBlockIndex* blockindex)
return result; return result;
} }
int convertstreamid(char *streamid_str, char *streamid_hex) { int32_t decode_hex(uint8_t *bytes,int32_t n,char *hex);
char decodedhextest[32]; bits256 bits256_conv(char *hexstr)
decode_hex(streamid_str,32,streamid_hex); {
printf("decoded hex: %s\n",decodedhextest); bits256 x;
memset(&x,0,sizeof(x));
if ( strlen(hexstr) == sizeof(x)*2)
decode_hex(x.bytes,sizeof(x.bytes),hexstr);
return(x);
} }
UniValue getdatafromblock(const UniValue& params, bool fHelp) UniValue getdatafromblock(const UniValue& params, bool fHelp)
@@ -349,7 +353,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp)
streamid = idstr; streamid = idstr;
} else if ( seqid == 2 ) { } else if ( seqid == 2 ) {
firsttxid = idstr; firsttxid = idstr;
} else if (firsttxid.isempty()) { } else if (firsttxid.empty()) {
firsttxid == idstr; firsttxid == idstr;
} }
if ( seqid == (lastseqid + 1 )) { if ( seqid == (lastseqid + 1 )) {
@@ -366,7 +370,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp)
} }
i = i + 1; i = i + 1;
} }
if (streamid.isempty()) { if (streamid.empty()) {
uint256 hash,firsttxid_256; CTransaction firsttx; uint256 hash,firsttxid_256; CTransaction firsttx;
firsttxid_256 = bits256_conv(firsttxid); firsttxid_256 = bits256_conv(firsttxid);
if (GetTransaction(firsttxid_256,firsttx,hash,false)) { if (GetTransaction(firsttxid_256,firsttx,hash,false)) {