fallback for getTx.
This commit is contained in:
parent
27a137022c
commit
f691072e33
@ -69,13 +69,13 @@ function getBlocks(bitcoind) {
|
|||||||
return bitcoind.getBlock(hash, function(err, block) {
|
return bitcoind.getBlock(hash, function(err, block) {
|
||||||
if (err) return print(err.message);
|
if (err) return print(err.message);
|
||||||
|
|
||||||
print(block);
|
// print(block);
|
||||||
|
|
||||||
if (argv['get-tx'] && block.tx.length && block.tx[0].txid) {
|
if (argv['get-tx'] && block.tx.length && block.tx[0].txid) {
|
||||||
var txid = block.tx[0].txid;
|
var txid = block.tx[0].txid;
|
||||||
// XXX Dies with a segfault
|
// XXX Dies with a segfault
|
||||||
// bitcoind.getTx(txid, hash, function(err, tx) {
|
// bitcoind.getTx(txid, hash, function(err, tx) {
|
||||||
bitcoind.getTx(txid, function(err, tx) {
|
bitcoind.getTx(txid, hash, function(err, tx) {
|
||||||
if (err) return print(err.message);
|
if (err) return print(err.message);
|
||||||
print('TX -----------------------------------------------------');
|
print('TX -----------------------------------------------------');
|
||||||
print(tx);
|
print(tx);
|
||||||
|
|||||||
@ -692,10 +692,17 @@ async_get_tx(uv_work_t *req) {
|
|||||||
uint256 hashBlock(data->blockHash);
|
uint256 hashBlock(data->blockHash);
|
||||||
CTransaction tx;
|
CTransaction tx;
|
||||||
|
|
||||||
if (GetTransaction(hash, tx, hashBlock, hashBlock == 0 ? true : false)) {
|
if (GetTransaction(hash, tx, hashBlock, hashBlock == uint256(0) ? true : false)) {
|
||||||
data->result_tx = tx;
|
data->result_tx = tx;
|
||||||
} else {
|
} else {
|
||||||
data->err_msg = std::string("get_tx(): failed.");
|
if (hashBlock != 0) {
|
||||||
|
hashBlock = uint256(0);
|
||||||
|
if (GetTransaction(hash, tx, hashBlock, true)) {
|
||||||
|
data->result_tx = tx;
|
||||||
|
} else {
|
||||||
|
data->err_msg = std::string("get_tx(): failed.");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user