allow wallet transactions to lookup their real counterparts.
This commit is contained in:
parent
a9a5f7c4ad
commit
7aaf4dce94
@ -809,13 +809,25 @@ Wallet.prototype.getUnconfirmedBalance = function(options) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// XXX Wallet Transactions
|
// XXX Wallet Transactions
|
||||||
// Convert to regular TX
|
|
||||||
Wallet.prototype.listTransactions =
|
Wallet.prototype.listTransactions =
|
||||||
Wallet.prototype.getTransactions = function(options) {
|
Wallet.prototype.getTransactions = function(options, callback) {
|
||||||
var txs = bitcoindjs.walletListTransactions(options || {});
|
var txs = bitcoindjs.walletListTransactions(options || {});
|
||||||
// return txs.map(function(tx) {
|
if (callback) {
|
||||||
// return Transaction.fromHex(tx.hex);
|
// Retrieve to regular TXs from disk:
|
||||||
// });
|
var out = [];
|
||||||
|
return utils.forEach(txs, function(tx, next) {
|
||||||
|
return bitcoindjs.getTx(tx.txid, tx.blockhash, function(err, tx_) {
|
||||||
|
if (err) return next(err);
|
||||||
|
var tx = bitcoin.tx(tx_);
|
||||||
|
tx._walletTransaction = tx_;
|
||||||
|
out.push(tx);
|
||||||
|
return next();
|
||||||
|
});
|
||||||
|
}, function(err) {
|
||||||
|
if (err) return callback(err);
|
||||||
|
return callback(null, out);
|
||||||
|
});
|
||||||
|
}
|
||||||
return txs;
|
return txs;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -830,10 +842,17 @@ Wallet.prototype.getAccounts = function(options) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// XXX Wallet Transaction
|
// XXX Wallet Transaction
|
||||||
// Convert to regular TX
|
Wallet.prototype.getTransaction = function(options, callback) {
|
||||||
Wallet.prototype.getTransaction = function(options) {
|
|
||||||
var tx = bitcoindjs.walletGetTransaction(options || {});
|
var tx = bitcoindjs.walletGetTransaction(options || {});
|
||||||
// return tx ? Transaction.fromHex(tx.hex) : tx;
|
if (callback) {
|
||||||
|
// Retrieve to regular TX from disk:
|
||||||
|
return bitcoindjs.getTx(tx.txid, tx.blockhash, function(err, tx_) {
|
||||||
|
if (err) return next(err);
|
||||||
|
var tx = bitcoin.tx(tx_);
|
||||||
|
tx._walletTransaction = tx_;
|
||||||
|
return callback(null, tx);
|
||||||
|
});
|
||||||
|
}
|
||||||
return tx;
|
return tx;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -4455,7 +4455,8 @@ NAN_METHOD(WalletGetTransaction) {
|
|||||||
|
|
||||||
Local<Array> details = NanNew<Array>();
|
Local<Array> details = NanNew<Array>();
|
||||||
int a_count = 0;
|
int a_count = 0;
|
||||||
ListTransactions_V8(wtx, "*", 0, false, details, filter, &a_count);
|
// NOTE: fLong is set to false in rpcwallet.cpp
|
||||||
|
ListTransactions_V8(wtx, "*", 0, /*fLong=*/ true, details, filter, &a_count);
|
||||||
entry->Set(NanNew<String>("details"), details);
|
entry->Set(NanNew<String>("details"), details);
|
||||||
|
|
||||||
//std::string strHex = EncodeHexTx(static_cast<CTransaction>(wtx));
|
//std::string strHex = EncodeHexTx(static_cast<CTransaction>(wtx));
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user