This commit is contained in:
Christopher Jeffrey 2014-09-22 12:06:55 -07:00
parent 29cb630f67
commit 1138779bed
1 changed files with 21 additions and 20 deletions

View File

@ -908,6 +908,7 @@ NAN_METHOD(GetTx) {
uint256 hashBlock(blockHash);
// uint256 hashBlock = 0;
CTransaction tx;
if (!GetTransaction(hash, tx, hashBlock, true)) {
Local<Value> err = Exception::Error(String::New("Bad Transaction."));
const unsigned argc = 1;
@ -919,27 +920,27 @@ NAN_METHOD(GetTx) {
}
cb.Dispose();
NanReturnValue(Undefined());
} else {
CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION);
ssTx << tx;
string strHex = HexStr(ssTx.begin(), ssTx.end());
Local<Object> obj = NanNew<Object>();
obj->Set(NanNew<String>("hex"), NanNew<String>(strHex.c_str()));
const unsigned argc = 2;
Local<Value> argv[argc] = {
Local<Value>::New(Null()),
Local<Value>::New(obj)
};
TryCatch try_catch;
cb->Call(Context::GetCurrent()->Global(), argc, argv);
if (try_catch.HasCaught()) {
node::FatalException(try_catch);
}
cb.Dispose();
NanReturnValue(Undefined());
}
CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION);
ssTx << tx;
string strHex = HexStr(ssTx.begin(), ssTx.end());
Local<Object> obj = NanNew<Object>();
obj->Set(NanNew<String>("hex"), NanNew<String>(strHex.c_str()));
const unsigned argc = 2;
Local<Value> argv[argc] = {
Local<Value>::New(Null()),
Local<Value>::New(obj)
};
TryCatch try_catch;
cb->Call(Context::GetCurrent()->Global(), argc, argv);
if (try_catch.HasCaught()) {
node::FatalException(try_catch);
}
cb.Dispose();
NanReturnValue(Undefined());
}
/**