Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[reliable payments] router payment state machine #2761

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
d027e10
htlcswitch+channeldb: move control tower to channeldb
halseth May 23, 2019
2417f40
channeldb: put payment status in new bucket
halseth May 23, 2019
f022810
channeldb/codec: add privateKey serialization
halseth May 23, 2019
178996f
channeldb/payments+control_tower: split OutgoingPayments
halseth May 23, 2019
801521e
channeldb/migration: add migration for new payment bucket structure
halseth May 23, 2019
693807c
channeldb/control_tower: add FetchSentPayments
halseth May 23, 2019
b7189ba
channeldb test: add TestOutgoingPaymentsMigration
halseth May 23, 2019
bb4aadd
channeldb/control_tower: remove non-strict option
halseth May 23, 2019
6d80661
channeldb/payments: add StatusFailed
halseth May 23, 2019
1af1832
channeldb/control_tower: add payment information during state changes
halseth May 23, 2019
59c2557
channeldb/control_tower test: test new payment behavior
halseth May 23, 2019
ae7bf2c
routing/router: move sending and receiving payment result into loop
halseth May 23, 2019
83bfaa4
routing: extract payment flow into method on paymentLifecycle
halseth May 23, 2019
e9b2182
routing/payment_lifecycle: extract error handling into method
halseth May 23, 2019
dd73c51
routing/payment_lifecycle: extract create attempt into method
halseth May 23, 2019
de1bf8a
routing/router: persist payment state machine
halseth May 23, 2019
677cb01
routing/control_tower: add FetchInFlightPayments
halseth May 23, 2019
3323800
routing/router: resume payment state machine at startup
halseth May 23, 2019
adc4640
routing: export MissionControl
halseth May 23, 2019
f4306b1
routing/payment_session+router: make PaymentSession interface
halseth May 23, 2019
3f76bc0
routing+server: define PaymentSessionSource
halseth May 23, 2019
60e2367
routing/router_test: add TestRouterPaymentStateMachine
halseth May 23, 2019
1b78890
channeldb+router: record payment failure reason in db
halseth May 23, 2019
d78d3f5
channeldb: move deprecated code to migration_09_legacy_serialization.go
halseth May 23, 2019
d705b8a
channeldb+multi: rename Grounded->Unknown, Completed->Succeeded
halseth May 23, 2019
95b4828
channeldb: derive PaymentStatus implicitly from stored info
halseth May 23, 2019
589f0fc
control_tower: make initial bucket bucket creation stricter
halseth May 23, 2019
649ee87
routing/router_test: add test case for ForwardingError on SendHTLC
halseth May 24, 2019
7cb25a5
channeldb/control_tower test: add TestPaymentControlDeleteNonInFlight
halseth May 27, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions channeldb/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,12 @@ func WriteElement(w io.Writer, element interface{}) error {
return err
}

case *btcec.PrivateKey:
b := e.Serialize()
if _, err := w.Write(b); err != nil {
return err
}

case *btcec.PublicKey:
b := e.SerializeCompressed()
if _, err := w.Write(b); err != nil {
Expand Down Expand Up @@ -320,6 +326,15 @@ func ReadElement(r io.Reader, element interface{}) error {

*e = lnwire.MilliSatoshi(a)

case **btcec.PrivateKey:
var b [btcec.PrivKeyBytesLen]byte
if _, err := io.ReadFull(r, b[:]); err != nil {
return err
}

priv, _ := btcec.PrivKeyFromBytes(btcec.S256(), b[:])
*e = priv

case **btcec.PublicKey:
var b [btcec.PubKeyBytesLenCompressed]byte
if _, err := io.ReadFull(r, b[:]); err != nil {
Expand Down
Loading