From 736a46ff81c7f0e79164253c353d13a577408a08 Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Wed, 13 May 2015 13:18:06 -0400 Subject: [PATCH] Use negative fees with listtransaction result types. This matches Bitcoin Core Wallet. Fixes #272. --- wallet/wallet.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wallet/wallet.go b/wallet/wallet.go index 2ba58e9..caef56a 100644 --- a/wallet/wallet.go +++ b/wallet/wallet.go @@ -870,7 +870,10 @@ func ListTransactions(details *wtxmgr.TxDetails, syncHeight int32, net *chaincfg for _, output := range details.MsgTx.TxOut { outputTotal += btcutil.Amount(output.Value) } - feeF64 = (debitTotal - outputTotal).ToBTC() + // Note: The actual fee is debitTotal - outputTotal. However, + // this RPC reports negative numbers for fees, so the inverse + // is calculated. + feeF64 = (outputTotal - debitTotal).ToBTC() } outputs: