|
@ -528,6 +528,7 @@ enum state state(const enum state state, const struct state_data *sdata, |
|
|
bitcoin_commit(effect, sdata)); |
|
|
bitcoin_commit(effect, sdata)); |
|
|
set_effect(effect, watch, |
|
|
set_effect(effect, watch, |
|
|
bitcoin_watch_delayed(effect, |
|
|
bitcoin_watch_delayed(effect, |
|
|
|
|
|
effect->broadcast, |
|
|
BITCOIN_ANCHOR_OURCOMMIT_DELAYPASSED)); |
|
|
BITCOIN_ANCHOR_OURCOMMIT_DELAYPASSED)); |
|
|
/* They could still close. */ |
|
|
/* They could still close. */ |
|
|
return STATE_CLOSE_WAIT_CLOSE_OURCOMMIT; |
|
|
return STATE_CLOSE_WAIT_CLOSE_OURCOMMIT; |
|
@ -612,7 +613,7 @@ enum state state(const enum state state, const struct state_data *sdata, |
|
|
set_effect(effect, broadcast, |
|
|
set_effect(effect, broadcast, |
|
|
bitcoin_spend_ours(effect, sdata)); |
|
|
bitcoin_spend_ours(effect, sdata)); |
|
|
set_effect(effect, watch, |
|
|
set_effect(effect, watch, |
|
|
bitcoin_watch(effect, |
|
|
bitcoin_watch(effect, effect->broadcast, |
|
|
BITCOIN_SPEND_OURS_DONE)); |
|
|
BITCOIN_SPEND_OURS_DONE)); |
|
|
bits &= ~STATE_CLOSE_OURCOMMIT_BIT; |
|
|
bits &= ~STATE_CLOSE_OURCOMMIT_BIT; |
|
|
bits |= STATE_CLOSE_SPENDOURS_BIT; |
|
|
bits |= STATE_CLOSE_SPENDOURS_BIT; |
|
@ -631,7 +632,7 @@ enum state state(const enum state state, const struct state_data *sdata, |
|
|
set_effect(effect, broadcast, |
|
|
set_effect(effect, broadcast, |
|
|
bitcoin_spend_theirs(effect, sdata)); |
|
|
bitcoin_spend_theirs(effect, sdata)); |
|
|
set_effect(effect, watch, |
|
|
set_effect(effect, watch, |
|
|
bitcoin_watch(effect, |
|
|
bitcoin_watch(effect, effect->broadcast, |
|
|
BITCOIN_SPEND_THEIRS_DONE)); |
|
|
BITCOIN_SPEND_THEIRS_DONE)); |
|
|
bits |= STATE_CLOSE_SPENDTHEM_BIT; |
|
|
bits |= STATE_CLOSE_SPENDTHEM_BIT; |
|
|
return base + bits; |
|
|
return base + bits; |
|
@ -643,7 +644,8 @@ enum state state(const enum state state, const struct state_data *sdata, |
|
|
return STATE_ERR_INFORMATION_LEAK; |
|
|
return STATE_ERR_INFORMATION_LEAK; |
|
|
set_effect(effect, broadcast, steal); |
|
|
set_effect(effect, broadcast, steal); |
|
|
set_effect(effect, watch, |
|
|
set_effect(effect, watch, |
|
|
bitcoin_watch(effect, BITCOIN_STEAL_DONE)); |
|
|
bitcoin_watch(effect, effect->broadcast, |
|
|
|
|
|
BITCOIN_STEAL_DONE)); |
|
|
bits |= STATE_CLOSE_STEAL_BIT; |
|
|
bits |= STATE_CLOSE_STEAL_BIT; |
|
|
return base + bits; |
|
|
return base + bits; |
|
|
} else if (input_is(input, BITCOIN_ANCHOR_UNSPENT)) |
|
|
} else if (input_is(input, BITCOIN_ANCHOR_UNSPENT)) |
|
@ -716,7 +718,7 @@ start_unilateral_close: |
|
|
set_effect(effect, stop_commands, true); |
|
|
set_effect(effect, stop_commands, true); |
|
|
set_effect(effect, broadcast, bitcoin_commit(effect, sdata)); |
|
|
set_effect(effect, broadcast, bitcoin_commit(effect, sdata)); |
|
|
set_effect(effect, watch, |
|
|
set_effect(effect, watch, |
|
|
bitcoin_watch_delayed(effect, |
|
|
bitcoin_watch_delayed(effect, effect->broadcast, |
|
|
BITCOIN_ANCHOR_OURCOMMIT_DELAYPASSED)); |
|
|
BITCOIN_ANCHOR_OURCOMMIT_DELAYPASSED)); |
|
|
return STATE_CLOSE_WAIT_OURCOMMIT; |
|
|
return STATE_CLOSE_WAIT_OURCOMMIT; |
|
|
|
|
|
|
|
@ -731,7 +733,8 @@ them_unilateral: |
|
|
set_effect(effect, stop_commands, true); |
|
|
set_effect(effect, stop_commands, true); |
|
|
set_effect(effect, broadcast, bitcoin_spend_theirs(effect, sdata)); |
|
|
set_effect(effect, broadcast, bitcoin_spend_theirs(effect, sdata)); |
|
|
set_effect(effect, watch, |
|
|
set_effect(effect, watch, |
|
|
bitcoin_watch(effect, BITCOIN_SPEND_THEIRS_DONE)); |
|
|
bitcoin_watch(effect, effect->broadcast, |
|
|
|
|
|
BITCOIN_SPEND_THEIRS_DONE)); |
|
|
return STATE_CLOSE_WAIT_SPENDTHEM; |
|
|
return STATE_CLOSE_WAIT_SPENDTHEM; |
|
|
|
|
|
|
|
|
accept_update: |
|
|
accept_update: |
|
@ -825,7 +828,8 @@ fail_during_close: |
|
|
set_effect(effect, broadcast, |
|
|
set_effect(effect, broadcast, |
|
|
bitcoin_spend_theirs(effect, sdata)); |
|
|
bitcoin_spend_theirs(effect, sdata)); |
|
|
set_effect(effect, watch, |
|
|
set_effect(effect, watch, |
|
|
bitcoin_watch(effect, BITCOIN_SPEND_THEIRS_DONE)); |
|
|
bitcoin_watch(effect, effect->broadcast, |
|
|
|
|
|
BITCOIN_SPEND_THEIRS_DONE)); |
|
|
/* Expect either close or spendthem to complete */ |
|
|
/* Expect either close or spendthem to complete */ |
|
|
return STATE_CLOSE_WAIT_SPENDTHEM_CLOSE; |
|
|
return STATE_CLOSE_WAIT_SPENDTHEM_CLOSE; |
|
|
} else if (input_is(input, BITCOIN_ANCHOR_OTHERSPEND)) { |
|
|
} else if (input_is(input, BITCOIN_ANCHOR_OTHERSPEND)) { |
|
@ -834,7 +838,8 @@ fail_during_close: |
|
|
return STATE_ERR_INFORMATION_LEAK; |
|
|
return STATE_ERR_INFORMATION_LEAK; |
|
|
set_effect(effect, broadcast, steal); |
|
|
set_effect(effect, broadcast, steal); |
|
|
set_effect(effect, watch, |
|
|
set_effect(effect, watch, |
|
|
bitcoin_watch(effect, BITCOIN_STEAL_DONE)); |
|
|
bitcoin_watch(effect, effect->broadcast, |
|
|
|
|
|
BITCOIN_STEAL_DONE)); |
|
|
/* Expect either close or steal to complete */ |
|
|
/* Expect either close or steal to complete */ |
|
|
return STATE_CLOSE_WAIT_STEAL_CLOSE; |
|
|
return STATE_CLOSE_WAIT_STEAL_CLOSE; |
|
|
} else if (input_is(input, BITCOIN_ANCHOR_UNSPENT)) { |
|
|
} else if (input_is(input, BITCOIN_ANCHOR_UNSPENT)) { |
|
@ -857,6 +862,7 @@ old_commit_spotted: |
|
|
if (!steal) |
|
|
if (!steal) |
|
|
return STATE_ERR_INFORMATION_LEAK; |
|
|
return STATE_ERR_INFORMATION_LEAK; |
|
|
set_effect(effect, broadcast, steal); |
|
|
set_effect(effect, broadcast, steal); |
|
|
set_effect(effect, watch, bitcoin_watch(effect, BITCOIN_STEAL_DONE)); |
|
|
set_effect(effect, watch, |
|
|
|
|
|
bitcoin_watch(effect, effect->broadcast, BITCOIN_STEAL_DONE)); |
|
|
return STATE_CLOSE_WAIT_STEAL; |
|
|
return STATE_CLOSE_WAIT_STEAL; |
|
|
} |
|
|
} |
|
|