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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user