|
|
@ -518,9 +518,9 @@ Value signrawtransaction(const Array& params, bool fHelp) |
|
|
|
|
|
|
|
|
|
|
|
Value sendrawtransaction(const Array& params, bool fHelp) |
|
|
|
Value sendrawtransaction(const Array& params, bool fHelp) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (fHelp || params.size() < 1 || params.size() > 1) |
|
|
|
if (fHelp || params.size() < 1 || params.size() > 2) |
|
|
|
throw runtime_error( |
|
|
|
throw runtime_error( |
|
|
|
"sendrawtransaction <hex string>\n" |
|
|
|
"sendrawtransaction <hex string> [allowhighfees=false]\n" |
|
|
|
"Submits raw transaction (serialized, hex-encoded) to local node and network."); |
|
|
|
"Submits raw transaction (serialized, hex-encoded) to local node and network."); |
|
|
|
|
|
|
|
|
|
|
|
// parse hex string from parameter
|
|
|
|
// parse hex string from parameter
|
|
|
@ -528,6 +528,10 @@ Value sendrawtransaction(const Array& params, bool fHelp) |
|
|
|
CDataStream ssData(txData, SER_NETWORK, PROTOCOL_VERSION); |
|
|
|
CDataStream ssData(txData, SER_NETWORK, PROTOCOL_VERSION); |
|
|
|
CTransaction tx; |
|
|
|
CTransaction tx; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool fOverrideFees = false; |
|
|
|
|
|
|
|
if (params.size() > 1) |
|
|
|
|
|
|
|
fOverrideFees = params[1].get_bool(); |
|
|
|
|
|
|
|
|
|
|
|
// deserialize binary data stream
|
|
|
|
// deserialize binary data stream
|
|
|
|
try { |
|
|
|
try { |
|
|
|
ssData >> tx; |
|
|
|
ssData >> tx; |
|
|
@ -545,7 +549,7 @@ Value sendrawtransaction(const Array& params, bool fHelp) |
|
|
|
if (!fHave) { |
|
|
|
if (!fHave) { |
|
|
|
// push to local node
|
|
|
|
// push to local node
|
|
|
|
CValidationState state; |
|
|
|
CValidationState state; |
|
|
|
if (!mempool.accept(state, tx, false, NULL)) |
|
|
|
if (!mempool.accept(state, tx, false, NULL, !fOverrideFees)) |
|
|
|
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX rejected"); // TODO: report validation state
|
|
|
|
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX rejected"); // TODO: report validation state
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|