I created a transaction with an offline wallet that spent outputs from two different addresses.
I then imported only one of those two private keys into bitcoind with importprivkey.
When I viewed the transaction in bitcoind I was shocked to see such an incredible fee! I realize it's because the fee is calculated from the perspective of the wallet, not the actual total vin - vout difference the miner actually collects:
vin:
0.00037120 from imported key
0.09799380 from the other key
vout:
0.09802500
actual miner fee:
0.00034000
fee reported by gettransaction:
0.09765380
$ bitcoin-cli gettransaction fa[...obfuscated...]39
{
"amount": -0.09802500,
"fee": 0.09765380,
"confirmations": 0,
"trusted": false,
"txid": "fa[...obfuscated...]39",
"walletconflicts": [
],
"time": 1513211216,
"timereceived": 1513211216,
"bip125-replaceable": "no",
"details": [
{
"account": "",
"address": "1[...obfuscated...]j",
"category": "send",
"amount": -0.09802500,
"vout": 0,
"fee": 0.09765380,
"abandoned": false
}
],
"hex": "01[...obfuscated...]00"
}