increase min_relay_tx_fee, and make dust_threshold a function
This commit is contained in:
@@ -30,8 +30,7 @@ import aes
|
|||||||
|
|
||||||
################################## transactions
|
################################## transactions
|
||||||
|
|
||||||
DUST_THRESHOLD = 546
|
MIN_RELAY_TX_FEE = 5000
|
||||||
MIN_RELAY_TX_FEE = 1000
|
|
||||||
RECOMMENDED_FEE = 50000
|
RECOMMENDED_FEE = 50000
|
||||||
COINBASE_MATURITY = 100
|
COINBASE_MATURITY = 100
|
||||||
COIN = 100000000
|
COIN = 100000000
|
||||||
|
|||||||
@@ -897,6 +897,9 @@ class Abstract_Wallet(PrintError):
|
|||||||
# this method can be overloaded
|
# this method can be overloaded
|
||||||
return tx.get_fee()
|
return tx.get_fee()
|
||||||
|
|
||||||
|
def dust_threshold(self):
|
||||||
|
return 182 * 3 * MIN_RELAY_TX_FEE/1000
|
||||||
|
|
||||||
@profiler
|
@profiler
|
||||||
def estimated_fee(self, tx, fee_per_kb):
|
def estimated_fee(self, tx, fee_per_kb):
|
||||||
estimated_size = len(tx.serialize(-1))/2
|
estimated_size = len(tx.serialize(-1))/2
|
||||||
@@ -975,7 +978,7 @@ class Abstract_Wallet(PrintError):
|
|||||||
change_amount = total - ( amount + fee )
|
change_amount = total - ( amount + fee )
|
||||||
if fixed_fee is not None and change_amount > 0:
|
if fixed_fee is not None and change_amount > 0:
|
||||||
tx.outputs.append(('address', change_addr, change_amount))
|
tx.outputs.append(('address', change_addr, change_amount))
|
||||||
elif change_amount > DUST_THRESHOLD:
|
elif change_amount > self.dust_threshold():
|
||||||
tx.outputs.append(('address', change_addr, change_amount))
|
tx.outputs.append(('address', change_addr, change_amount))
|
||||||
# recompute fee including change output
|
# recompute fee including change output
|
||||||
fee = self.estimated_fee(tx, fee_per_kb)
|
fee = self.estimated_fee(tx, fee_per_kb)
|
||||||
@@ -983,7 +986,7 @@ class Abstract_Wallet(PrintError):
|
|||||||
tx.outputs.pop()
|
tx.outputs.pop()
|
||||||
# if change is still above dust threshold, re-add change output.
|
# if change is still above dust threshold, re-add change output.
|
||||||
change_amount = total - ( amount + fee )
|
change_amount = total - ( amount + fee )
|
||||||
if change_amount > DUST_THRESHOLD:
|
if change_amount > self.dust_threshold():
|
||||||
tx.outputs.append(('address', change_addr, change_amount))
|
tx.outputs.append(('address', change_addr, change_amount))
|
||||||
self.print_error('change', change_amount)
|
self.print_error('change', change_amount)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user