)
This commit is contained in:
@@ -390,14 +390,14 @@ UniValue NSPV_broadcast(char *hex)
|
|||||||
decode_hex(data,n,hex);
|
decode_hex(data,n,hex);
|
||||||
_txid = bits256_doublesha256(0,data,n);
|
_txid = bits256_doublesha256(0,data,n);
|
||||||
for (i=0; i<32; i++)
|
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 = (uint8_t *)malloc(1 + sizeof(txid) + sizeof(n) + n);
|
||||||
msg[len++] = NSPV_BROADCAST;
|
msg[len++] = NSPV_BROADCAST;
|
||||||
len += iguana_rwbignum(1,&msg[len],sizeof(txid),(uint8_t *)&txid);
|
len += iguana_rwbignum(1,&msg[len],sizeof(txid),(uint8_t *)&txid);
|
||||||
len += iguana_rwnum(1,&msg[len],sizeof(n),&n);
|
len += iguana_rwnum(1,&msg[len],sizeof(n),&n);
|
||||||
memcpy(&msg[len],data,n), len += n;
|
memcpy(&msg[len],data,n), len += n;
|
||||||
free(data);
|
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 )
|
if ( NSPV_req(0,msg,len,NODE_NSPV,msg[0]>>1) != 0 )
|
||||||
{
|
{
|
||||||
for (i=0; i<NSPV_POLLITERS; i++)
|
for (i=0; i<NSPV_POLLITERS; i++)
|
||||||
|
|||||||
@@ -1282,6 +1282,8 @@ UniValue signrawtransaction(const UniValue& params, bool fHelp)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern UniValue NSPV_broadcast(char *hex);
|
||||||
|
|
||||||
UniValue sendrawtransaction(const UniValue& params, bool fHelp)
|
UniValue sendrawtransaction(const UniValue& params, bool fHelp)
|
||||||
{
|
{
|
||||||
if (fHelp || params.size() < 1 || params.size() > 2)
|
if (fHelp || params.size() < 1 || params.size() > 2)
|
||||||
@@ -1340,8 +1342,12 @@ UniValue sendrawtransaction(const UniValue& params, bool fHelp)
|
|||||||
} else if (fHaveChain) {
|
} else if (fHaveChain) {
|
||||||
throw JSONRPCError(RPC_TRANSACTION_ALREADY_IN_CHAIN, "transaction already in block chain");
|
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();
|
return hashTx.GetHex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user