Skip to content

Commit 4106f69

Browse files
committed
taprpc+tapfreighter: add next_send_state field to SendEvent
Adds a new field, next_send_state, to the SendEvent message. This enables integration tests to determine the upcoming state in the send state machine.
1 parent 3a7b6c1 commit 4106f69

File tree

5 files changed

+243
-219
lines changed

5 files changed

+243
-219
lines changed

rpcserver.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4252,6 +4252,7 @@ func marshalSendEvent(event fn.Event) (*taprpc.SendEvent, error) {
42524252
VirtualPackets: make([][]byte, len(e.VirtualPackets)),
42534253
PassiveVirtualPackets: make([][]byte, len(e.PassivePackets)),
42544254
TransferLabel: e.TransferLabel,
4255+
NextSendState: e.NextSendState.String(),
42554256
}
42564257

42574258
if e.Error != nil {

tapfreighter/chain_porter.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1789,6 +1789,9 @@ type AssetSendEvent struct {
17891789
// Error below is set, then it means executing this state failed.
17901790
SendState SendState
17911791

1792+
// NextSendState is the next state that will be executed.
1793+
NextSendState SendState
1794+
17921795
// Error is an optional error, indicating that something went wrong
17931796
// during the execution of the SendState above.
17941797
Error error
@@ -1827,8 +1830,9 @@ func newAssetSendEvent(executedState SendState,
18271830
pkg sendPackage) *AssetSendEvent {
18281831

18291832
newSendEvent := &AssetSendEvent{
1830-
timestamp: time.Now().UTC(),
1831-
SendState: executedState,
1833+
timestamp: time.Now().UTC(),
1834+
SendState: executedState,
1835+
NextSendState: pkg.SendState,
18321836
// The parcel remains static throughout the state machine, so we
18331837
// don't need to copy it, there can be no data race.
18341838
Parcel: pkg.Parcel,
@@ -1855,6 +1859,7 @@ func newAssetSendErrorEvent(err error, executedState SendState,
18551859
return &AssetSendEvent{
18561860
timestamp: time.Now().UTC(),
18571861
SendState: executedState,
1862+
NextSendState: pkg.SendState,
18581863
Error: err,
18591864
Parcel: pkg.Parcel,
18601865
TransferLabel: pkg.Label,

0 commit comments

Comments
 (0)