txout must be within tx! */
| 5 | |
| 6 | /* txout must be within tx! */ |
| 7 | struct penalty_base *penalty_base_new(const tal_t *ctx, |
| 8 | u64 commitment_num, |
| 9 | const struct bitcoin_tx *tx, |
| 10 | const struct wally_tx_output *txout) |
| 11 | { |
| 12 | struct penalty_base *pbase = tal(ctx, struct penalty_base); |
| 13 | |
| 14 | pbase->commitment_num = commitment_num; |
| 15 | bitcoin_txid(tx, &pbase->txid); |
| 16 | pbase->outnum = txout - tx->wtx->outputs; |
| 17 | assert(pbase->outnum < tx->wtx->num_outputs); |
| 18 | pbase->amount = amount_sat(txout->satoshi); |
| 19 | |
| 20 | return pbase; |
| 21 | } |
| 22 | |
| 23 | void towire_penalty_base(u8 **pptr, const struct penalty_base *pbase) |
| 24 | { |
no test coverage detected