diff --git a/src/libbitcoind.cc b/src/libbitcoind.cc index b3e0fd6d..0c3b8758 100644 --- a/src/libbitcoind.cc +++ b/src/libbitcoind.cc @@ -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(state.GetRejectCode()) + ": " + state.GetRejectReason()).c_str()); } else { if (fMissingInputs) { return NanThrowError("Missing inputs"); diff --git a/src/libbitcoind.h b/src/libbitcoind.h index 12bdc7b5..2d05341f 100644 --- a/src/libbitcoind.h +++ b/src/libbitcoind.h @@ -8,6 +8,7 @@ #include "txdb.h" #include #include +#include #include "nan.h" #include "scheduler.h" #include "core_io.h"