onchaind: don't create zero-output txs if fees overwhelm us.

They're illegal.  Instead do OP_RETURN so we don't pollute the UTXO.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2018-03-07 10:36:56 +10:30
committed by Christian Decker
parent 27c4e926bd
commit 45e145df5e
3 changed files with 17 additions and 4 deletions

View File

@@ -22,6 +22,7 @@
#define OP_NOTIF 0x64
#define OP_ELSE 0x67
#define OP_ENDIF 0x68
#define OP_RETURN 0x6a
#define OP_2DROP 0x6d
#define OP_DEPTH 0x74
#define OP_DROP 0x75
@@ -214,6 +215,14 @@ u8 *scriptpubkey_p2pkh(const tal_t *ctx, const struct bitcoin_address *addr)
return script;
}
u8 *scriptpubkey_opreturn(const tal_t *ctx)
{
u8 *script = tal_arr(ctx, u8, 0);
add_op(&script, OP_RETURN);
return script;
}
/* Create an input script which spends p2pkh */
u8 *bitcoin_redeem_p2pkh(const tal_t *ctx, const struct pubkey *pubkey,
const secp256k1_ecdsa_signature *sig)