Ejemplo n.º 1
0
    def calculate_cost_for_certificate_batch(self):
        """
        2 outputs (which is based on dust) + transaction fee. Note assumes 1 input per tx.
        :return:
        """

        total = tx_utils.calculate_tx_total(self.tx_cost_constants, 1, 2)
        return total
Ejemplo n.º 2
0
 def calculate_cost_for_certificate_batch(self):
     """
     Per certificate, we pay 2*min_per_output (which is based on dust) + fee. Note assumes 1 input
     per tx.
     :return:
     """
     num_inputs = 1
     # output per recipient
     num_outputs = len(self.certificates_to_issue)
     # plus revocation outputs
     num_outputs += sum(1 for c in self.certificates_to_issue.values() if c.revocation_key)
     # plus global revocation, change output, and OP_RETURN
     num_outputs += 3
     total = tx_utils.calculate_tx_total(self.tx_cost_constants, num_inputs, num_outputs)
     return total
Ejemplo n.º 3
0
 def test_get_cost_4(self):
     cost_constants = TransactionCostConstants(0.0001, 0.0000275, 41)
     total = tx_utils.calculate_tx_total(cost_constants, 1, 2000)
     self.assertEqual(total, 8296282)
Ejemplo n.º 4
0
 def test_calculate_tx_fee_1(self):
     cost_constants = TransactionCostConstants(0.0001, 0.0000275, 41)
     total = tx_utils.calculate_tx_total(cost_constants, 40, 16)
     self.assertEqual(total, 312837)
Ejemplo n.º 5
0
 def test_get_cost_4(self):
     cost_constants = TransactionCostConstants(0.0001, 0.0000275, 41)
     total = tx_utils.calculate_tx_total(cost_constants, 1, 2000)
     self.assertEqual(total, 8296282)
Ejemplo n.º 6
0
 def test_calculate_tx_fee_1(self):
     cost_constants = TransactionCostConstants(0.0001, 0.0000275, 41)
     total = tx_utils.calculate_tx_total(cost_constants, 40, 16)
     self.assertEqual(total, 312837)
Ejemplo n.º 7
0
 def test_get_cost_1(self):
     cost_constants = BitcoinTransactionCostConstants(0.0001, 0.0000275, 41)
     total = tx_utils.calculate_tx_total(cost_constants, 1, 1)
     self.assertEqual(total, 12750)