Performed lexical cast on the reject code instead of using a sprintf.

This commit is contained in:
Chris Kleeschulte 2015-09-09 12:28:05 -04:00
parent 13b5c065f3
commit 1ac02c5276
2 changed files with 2 additions and 4 deletions

View File

@ -1478,10 +1478,7 @@ NAN_METHOD(SendTransaction) {
// Attempt to add the transaction to the mempool
if (!AcceptToMemoryPool(mempool, state, tx, false, &fMissingInputs, !allowAbsurdFees)) {
if (state.IsInvalid()) {
// TODO: use boost::lexical_cast or C++11 std::to_string
char errorMessage [1024];
sprintf(errorMessage, "%i: %s", state.GetRejectCode(), state.GetRejectReason().c_str());
return NanThrowError(errorMessage);
return NanThrowError((boost::lexical_cast<std::string>(state.GetRejectCode()) + ": " + state.GetRejectReason()).c_str());
} else {
if (fMissingInputs) {
return NanThrowError("Missing inputs");

View File

@ -8,6 +8,7 @@
#include "txdb.h"
#include <boost/thread.hpp>
#include <boost/filesystem.hpp>
#include <boost/lexical_cast.hpp>
#include "nan.h"
#include "scheduler.h"
#include "core_io.h"