(self, tx, prev_tx, prev_n)
| 1364 | |
| 1365 | # update the fee output amount and also move it to the end |
| 1366 | def update_fee(self, tx, prev_tx, prev_n): |
| 1367 | total_out = 0 |
| 1368 | for i in reversed(range(len(tx.vout))): |
| 1369 | if tx.vout[i].is_fee(): |
| 1370 | del tx.vout[i] |
| 1371 | else: |
| 1372 | total_out += tx.vout[i].nValue.getAmount() |
| 1373 | fee = prev_tx.vout[prev_n].nValue.getAmount() - total_out |
| 1374 | if fee > 0: |
| 1375 | tx.vout.append(CTxOut(fee)) |
| 1376 | tx.calc_sha256() |
| 1377 | |
| 1378 | # sign a transaction, using the key we know about |
| 1379 | # this signs input 0 in tx, which is assumed to be spending output 0 in spend_tx |
no test coverage detected