github.com/mit-dci/lit@v0.0.0-20221102210550-8c3d3b49f2ce/qln/events.go (about) 1 package qln 2 3 import ( 4 "github.com/mit-dci/lit/crypto/koblitz" 5 "github.com/mit-dci/lit/eventbus" 6 ) 7 8 // ChannelStateUpdateEvent is a struct for a channel state update event 9 type ChannelStateUpdateEvent struct { 10 11 // Because a lot of these update events are similar, we can use the same 12 // structure for all of them and have a dynamic name, which you wouldn't 13 // normally do. 14 Action string 15 16 // We include ChanIdx so we can do stuff internally if implemented, and we include State because it's a state 17 // update event, so we'd like to know the new state. 18 ChanIdx uint32 19 State *StatCom 20 21 // in case an external application is using this and needs the public key for some reason. 22 TheirPub koblitz.PublicKey 23 24 // We need to know which coin this was for 25 CoinType uint32 26 } 27 28 // Name returns the name of the channel state update event 29 func (e ChannelStateUpdateEvent) Name() string { 30 return "qln.chanupdate." + e.Action 31 } 32 33 // Flags returns the flags for the event 34 func (e ChannelStateUpdateEvent) Flags() uint8 { 35 return eventbus.EFLAG_ASYNC 36 }