more debugging.

This commit is contained in:
Christopher Jeffrey 2014-09-22 12:14:51 -07:00
parent 2a0f777dbd
commit 0fd0b7c7b6
2 changed files with 21 additions and 2 deletions

View File

@ -145,6 +145,10 @@ Bitcoin.prototype.getBlock = function(hash, callback) {
};
Bitcoin.prototype.getTx = function(hash, blockHash, callback) {
if (hash[1] === 'x') hash = hash.slice(2);
if (blockHash[1] === 'x') blockHash = blockHash.slice(2);
// hash = utils.revHex(hash);
// blockHash = utils.revHex(blockHash);
return bitcoindjs.getTx(hash, blockHash, callback);
};
@ -181,6 +185,20 @@ Bitcoin.prototype.close = function(callback) {
});
};
/**
* Utils
*/
var utils = {};
utils.revHex = function revHex(s) {
var r = '';
for (var i = 0; i < s.length; i += 2) {
r = s.slice(i, i + 2) + r;
}
return r;
};
/**
* Expose
*/
@ -188,3 +206,4 @@ Bitcoin.prototype.close = function(callback) {
module.exports = exports = Bitcoin;
exports.Bitcoin = Bitcoin;
exports.native = bitcoindjs;
exports.utils = utils;

View File

@ -904,8 +904,8 @@ NAN_METHOD(GetTx) {
blockHash = "0x" + blockHash;
}
printf("tx: %s\n", txHash);
printf("block: %s\n", blockHash);
printf("tx: %s\n", txHash.c_str());
printf("block: %s\n", blockHash.c_str());
uint256 hash(txHash);
uint256 hashBlock(blockHash);