mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-26 09:14:20 +01:00
bitcoind: work around fundrawtransaction segwit issue.
See https://github.com/sipa/bitcaoin/issues/67 Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -195,6 +195,14 @@ u8 *linearize_tx(const tal_t *ctx, const struct bitcoin_tx *tx)
|
||||
return arr;
|
||||
}
|
||||
|
||||
u8 *linearize_tx_force_extended(const tal_t *ctx,
|
||||
const struct bitcoin_tx *tx)
|
||||
{
|
||||
u8 *arr = tal_arr(ctx, u8, 0);
|
||||
add_tx(tx, add_linearize, &arr, true);
|
||||
return arr;
|
||||
}
|
||||
|
||||
void bitcoin_txid(const struct bitcoin_tx *tx, struct sha256_double *txid)
|
||||
{
|
||||
struct sha256_ctx ctx = SHA256_INIT;
|
||||
|
||||
@@ -46,6 +46,10 @@ void sha256_tx_for_sig(struct sha256_ctx *ctx, const struct bitcoin_tx *tx,
|
||||
/* Linear bytes of tx. */
|
||||
u8 *linearize_tx(const tal_t *ctx, const struct bitcoin_tx *tx);
|
||||
|
||||
/* Force linearization in extended form; useful if 0 inputs. */
|
||||
u8 *linearize_tx_force_extended(const tal_t *ctx,
|
||||
const struct bitcoin_tx *tx);
|
||||
|
||||
/* Allocate a tx: you just need to fill in inputs and outputs (they're
|
||||
* zeroed with inputs' sequence_number set to FFFFFFFF) */
|
||||
struct bitcoin_tx *bitcoin_tx(const tal_t *ctx, varint_t input_count,
|
||||
|
||||
@@ -519,7 +519,7 @@ void bitcoind_fund_transaction(struct lightningd_state *dstate,
|
||||
struct peer *peer)
|
||||
{
|
||||
struct funding_process *f = tal(peer, struct funding_process);
|
||||
u8 *raw = linearize_tx(dstate, tx_no_inputs);
|
||||
u8 *raw = linearize_tx_force_extended(dstate, tx_no_inputs);
|
||||
char *hex = tal_arr(raw, char, hex_str_size(tal_count(raw)));
|
||||
|
||||
assert(tx_no_inputs->input_count == 0);
|
||||
|
||||
Reference in New Issue
Block a user