Bitcoin getFee() and _estimateFee

Hi all, how does notot work following methods in Bitcore?
transaction.getFee()
transaction._estimateFee()

can You help?
thanks

They do work, if you have information about inputs. What’s your use case?

In the previous version of bitcore this code worked correctly

peer.sendMessage(messages.GetData(message.inventory));
peer.on(‘tx’, function (tx) {
var transaction = tx.transaction;
console.log(transaction.getFee());
console.log();
console.log(transaction._estimateFee());
})

but after recent update to the last version it throws this
/root/testBitcore/node_modules/bitcore/lib/transaction/transaction.js:715
throw new errors.Transaction.Input.MissingPreviousOutput();
^
No previous output information.
Error
at Error.NodeError (/root/testBitcore/node_modules/bitcore/lib/errors/index.js:20:41)

Getting the fee from a serialized transaction is not possible without having the previous output, it’s likely it wasn’t working before but only returning zero.

1 Like