This commit is contained in:
jl777
2019-07-06 00:26:28 -11:00
parent 820b9efaeb
commit 3bf999989d
2 changed files with 9 additions and 3 deletions

View File

@@ -390,14 +390,14 @@ UniValue NSPV_broadcast(char *hex)
decode_hex(data,n,hex);
_txid = bits256_doublesha256(0,data,n);
for (i=0; i<32; i++)
((uint8_t *)&txid[i] = _txid.bytes[31 - i];
((uint8_t *)&txid)[i] = _txid.bytes[31 - i];
msg = (uint8_t *)malloc(1 + sizeof(txid) + sizeof(n) + n);
msg[len++] = NSPV_BROADCAST;
len += iguana_rwbignum(1,&msg[len],sizeof(txid),(uint8_t *)&txid);
len += iguana_rwnum(1,&msg[len],sizeof(n),&n);
memcpy(&msg[len],data,n), len += n;
free(data);
fprintf(stderr,"send txid.%s\n",txid.GetHex().c_str());
//fprintf(stderr,"send txid.%s\n",txid.GetHex().c_str());
if ( NSPV_req(0,msg,len,NODE_NSPV,msg[0]>>1) != 0 )
{
for (i=0; i<NSPV_POLLITERS; i++)

View File

@@ -1282,6 +1282,8 @@ UniValue signrawtransaction(const UniValue& params, bool fHelp)
return result;
}
extern UniValue NSPV_broadcast(char *hex);
UniValue sendrawtransaction(const UniValue& params, bool fHelp)
{
if (fHelp || params.size() < 1 || params.size() > 2)
@@ -1340,8 +1342,12 @@ UniValue sendrawtransaction(const UniValue& params, bool fHelp)
} else if (fHaveChain) {
throw JSONRPCError(RPC_TRANSACTION_ALREADY_IN_CHAIN, "transaction already in block chain");
}
RelayTransaction(tx);
}
else
{
NSPV_broadcast((char *)params[0].get_str().c_str());
}
RelayTransaction(tx);
return hashTx.GetHex();
}