def test_accurate_uncompressed(self):
     assert estimate_tx_fee(1, 2, 70, False) == 18060
 def test_none(self):
     assert estimate_tx_fee(5, 5, 0, True) == 0
 def test_accurate_compressed(self):
     assert estimate_tx_fee(1, 2, 70, True) == 15820
Example #4
0
 def test_none(self):
     assert estimate_tx_fee(740, 5, 170, 5, 0) == 0
Example #5
0
 def test_accurate_uncompressed(self):
     assert estimate_tx_fee(180, 1, 68, 2, 70) == 18060
Example #6
0
 def test_accurate_compressed(self):
     assert estimate_tx_fee(148, 1, 68, 2, 70) == 15820
Example #7
0
def estimate_tx_fee_kb(in_size, n_in, out_size, n_out, fee_kb) -> int:
    """Estimates transaction fee using satoshis per kilobyte"""

    fee_byte = Fraction(fee_kb, BYTES_IN_KB)
    fee = estimate_tx_fee(in_size, n_in, out_size, n_out, fee_byte)
    return math.ceil(fee)