Changed types back to std::string for getBlock hash.

This commit is contained in:
Braydon Fuller 2015-07-14 15:17:45 -04:00 committed by Chris Kleeschulte
parent 36e3343432
commit e1568d5738
1 changed files with 14 additions and 11 deletions

View File

@ -117,7 +117,7 @@ struct async_node_data {
struct async_block_data { struct async_block_data {
std::string err_msg; std::string err_msg;
const char* hash; std::string hash;
int64_t height; int64_t height;
char* buffer; char* buffer;
uint32_t size; uint32_t size;
@ -132,8 +132,8 @@ struct async_block_data {
struct async_tx_data { struct async_tx_data {
std::string err_msg; std::string err_msg;
const char* txid; std::string txid;
const char* blockhash; std::string blockhash;
CTransaction ctx; CTransaction ctx;
Eternal<Function> callback; Eternal<Function> callback;
}; };
@ -708,12 +708,13 @@ NAN_METHOD(GetBlock) {
if (args[0]->IsNumber()) { if (args[0]->IsNumber()) {
int64_t height = args[0]->IntegerValue(); int64_t height = args[0]->IntegerValue();
data->err_msg = std::string(""); data->err_msg = std::string("");
data->hash = NULL; data->hash = std::string("");
data->height = height; data->height = height;
} else { } else {
String::Utf8Value hash_(args[0]->ToString()); String::Utf8Value hash_(args[0]->ToString());
std::string hash = std::string(*hash_);
data->err_msg = std::string(""); data->err_msg = std::string("");
data->hash = *hash_; data->hash = hash;
data->height = -1; data->height = -1;
} }
@ -847,15 +848,17 @@ NAN_METHOD(GetTransaction) {
async_tx_data *data = new async_tx_data(); async_tx_data *data = new async_tx_data();
data->err_msg = std::string(""); data->err_msg = std::string("");
data->txid = *txid_; data->txid = std::string("");
std::string txid = std::string(*txid_);
std::string blockhash = std::string(*blockhash_);
data->txid = txid;
Eternal<Function> eternal(isolate, callback); Eternal<Function> eternal(isolate, callback);
data->callback = eternal; data->callback = eternal;
if (blockhash_.length() == 0) { if (blockhash == "") {
data->blockhash = uint256().GetHex().c_str(); data->blockhash = uint256().GetHex();
}
else {
data->blockhash = *blockhash_;
} }
uv_work_t *req = new uv_work_t(); uv_work_t *req = new uv_work_t();