From aj at erisian.com.au Tue Sep 29 06:47:40 2015 From: aj at erisian.com.au (Anthony Towns) Date: Tue, 29 Sep 2015 16:47:40 +1000 Subject: [Lightning-dev] Minor protocol revisions. In-Reply-To: References: <87r3lo2wsi.fsf@rustcorp.com.au> Message-ID: <20150929064740.GA9432@navy> On Thu, Sep 24, 2015 at 12:25:11PM +0200, Pierre wrote: > > 1) Close now has an second ACK stage, which means you know the close ack > Argh, I already have trouble understanding the rationale behind all > the existing closing flows and states :-s Would it be possible to > publish an updated version of the svg ? aj, any chance you could do > the same with your 'flat' version ? Yeah. I've updated state.py so the following flow works: $ test/test_state_coverage --dump-states | tee STATES $ ./state.py > update.dot $ dot -Tsvg update.dot > update.svg state.py is at https://github.com/ajtowns/lightning/blob/state/state.py Updated svg is viewable at http://azure.erisian.com.au/~aj/tmp/lightstate/simplified-states-20150929.svg Note that some transitions are still missing, notably PKT_UPDATE_DECLINE_HTLC. (I'm not following why the state coverage testing doesn't do something more like: states = [] path_to_state = {} for s in init_states: path_to_states[s] = [s] states.append(s) i = 0 while i < len(states): tst_state = states[i] p = path_to_states[tst_state] for in_pkt in all_packets: # enter test state simulation_init(p[0]) for setup_pkt in p[1:]: simulation_send_pkt(setup_pkt) # send packet new_state, response_pkt = simulation_send_pkt(in_pkt) # document result dump_transition(tst_state, in_pkt, new_state, response_pkt) # if new state, add it to list to test if new_state not in states: path_to_state[new_state] = p + [in_pkt] states.append(new_state) ie, for every state, throw every packet at it and record what happens; assuming that any given state behaves the same no matter how you get into it) Cheers, aj