1
0

Move estimated_fee to Transaction class

It's not a function of the wallet but of the transaction
so it more naturally belongs there.
This commit is contained in:
Neil Booth
2015-11-28 21:28:54 +09:00
parent e9061ea371
commit 90dee43998
5 changed files with 14 additions and 16 deletions

View File

@@ -22,7 +22,7 @@
import bitcoin
from bitcoin import *
from util import print_error
from util import print_error, profiler
import time
import sys
import struct
@@ -689,6 +689,14 @@ class Transaction:
def get_fee(self):
return self.input_value() - self.output_value()
@profiler
def estimated_fee(self, fee_per_kb):
estimated_size = len(self.serialize(-1)) / 2
fee = int(fee_per_kb * estimated_size / 1000.)
if fee < MIN_RELAY_TX_FEE:
fee = MIN_RELAY_TX_FEE
return fee
def signature_count(self):
r = 0
s = 0