onchaind: Eliminate a chicken-and-egg problem with msg parsing

Turns out that if we have the init message contain both the chainparams as
well as a transaction that needs to be parsed we need to set the parser to
elements mode before we reach the transaction...
This commit is contained in:
Christian Decker
2019-07-31 19:47:50 +02:00
committed by Rusty Russell
parent fad9a74662
commit 314622028f
5 changed files with 7 additions and 3 deletions

View File

@@ -2634,6 +2634,7 @@ int main(int argc, char *argv[])
msg = wire_sync_read(tmpctx, REQ_FD);
if (!fromwire_onchain_init(tmpctx, msg,
&shachain,
&is_elements,
&chain_hash,
&funding,
&old_remote_per_commit_point,
@@ -2662,7 +2663,6 @@ int main(int argc, char *argv[])
}
tx->chainparams = chainparams_by_chainhash(&chain_hash);
is_elements = tx->chainparams->is_elements;
status_debug("feerate_per_kw = %u", feerate_per_kw);
bitcoin_txid(tx, &txid);