Returns the fee of this transaction in satoshi
(self)
| 147 | return result |
| 148 | |
| 149 | def fee(self): |
| 150 | '''Returns the fee of this transaction in satoshi''' |
| 151 | # initialize input sum and output sum |
| 152 | input_sum, output_sum = 0, 0 |
| 153 | # use TxIn.value() to sum up the input amounts |
| 154 | for tx_in in self.tx_ins: |
| 155 | input_sum += tx_in.value(self.testnet) |
| 156 | # use TxOut.amount to sum up the output amounts |
| 157 | for tx_out in self.tx_outs: |
| 158 | output_sum += tx_out.amount |
| 159 | # fee is input sum - output sum |
| 160 | return input_sum - output_sum |
| 161 | |
| 162 | def sig_hash(self, input_index, redeem_script=None): |
| 163 | '''Returns the integer representation of the hash that needs to get |