]> git.bitcoin.ninja Git - rust-lightning/commit
Implement interactive tx construction protocol via `InteractiveTxConstructor`
authorDuncan Dean <duncangleeddean@gmail.com>
Tue, 21 Mar 2023 19:12:53 +0000 (21:12 +0200)
committerDuncan Dean <git@dunxen.dev>
Thu, 14 Mar 2024 14:10:46 +0000 (16:10 +0200)
commitc56198ade5dc69f86429db69cd52a767fa5fbb52
treeea94bec7d016da1675ef51ebf16d8c406d2a8721
parent6d5c952556aefa8f61c5a2c74ff72f426f5406ac
Implement interactive tx construction protocol via `InteractiveTxConstructor`

This implements the interactive construction protocol described at
https://github.com/lightning/bolts/blob/78e5a6b066d3a8e235931dfc06aa325337874749/02-peer-protocol.md?plain=1#L92.

Our implementation includes a state machine with typed states and transitions
to ensure consumers have compile-time assurances that the protocol is upheld.

States are tracked as in the `StateMachine` enum and can take on all
possible states during the negotiation.

The states are further divided into two categories, namely by the two traits
they implement, either `ReceivedMsgState` or `SentMsgState`.

The defined `StateTransitions` enforce the transitions that `ReceivedMsgState`,
`SentMsgState`, and the `_TxComplete`s can go through.

Co-authored-by: Wilmer Paulino <9447167+wpaulino@users.noreply.github.com>
Co-authored-by: Duncan Dean <git@dunxen.dev>
Co-authored-by: Jurvis Tan <5944973+jurvis@users.noreply.github.com>
lightning/src/events/bump_transaction.rs
lightning/src/ln/interactivetxs.rs [new file with mode: 0644]
lightning/src/ln/mod.rs
lightning/src/ln/msgs.rs
lightning/src/util/ser.rs