2020-05-04 10:47:01 +03:00
|
|
|
package itest
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/btcsuite/btcd/wire"
|
|
|
|
"github.com/btcsuite/btcutil"
|
2020-10-06 21:56:10 +03:00
|
|
|
"github.com/lightningnetwork/lnd/chainreg"
|
2020-05-04 10:47:01 +03:00
|
|
|
"github.com/lightningnetwork/lnd/lnrpc"
|
2020-05-04 10:52:15 +03:00
|
|
|
"github.com/lightningnetwork/lnd/lnrpc/routerrpc"
|
2020-05-04 10:47:01 +03:00
|
|
|
"github.com/lightningnetwork/lnd/lntest"
|
|
|
|
)
|
|
|
|
|
|
|
|
func testMultiHopPayments(net *lntest.NetworkHarness, t *harnessTest) {
|
|
|
|
ctxb := context.Background()
|
|
|
|
|
|
|
|
const chanAmt = btcutil.Amount(100000)
|
|
|
|
var networkChans []*lnrpc.ChannelPoint
|
|
|
|
|
|
|
|
// Open a channel with 100k satoshis between Alice and Bob with Alice
|
|
|
|
// being the sole funder of the channel.
|
|
|
|
ctxt, _ := context.WithTimeout(ctxb, channelOpenTimeout)
|
|
|
|
chanPointAlice := openChannelAndAssert(
|
|
|
|
ctxt, t, net, net.Alice, net.Bob,
|
|
|
|
lntest.OpenChannelParams{
|
|
|
|
Amt: chanAmt,
|
|
|
|
},
|
|
|
|
)
|
|
|
|
networkChans = append(networkChans, chanPointAlice)
|
|
|
|
|
2021-02-13 11:05:33 +03:00
|
|
|
aliceChanTXID, err := lnrpc.GetChanPointFundingTxid(chanPointAlice)
|
2020-05-04 10:47:01 +03:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("unable to get txid: %v", err)
|
|
|
|
}
|
|
|
|
aliceFundPoint := wire.OutPoint{
|
|
|
|
Hash: *aliceChanTXID,
|
|
|
|
Index: chanPointAlice.OutputIndex,
|
|
|
|
}
|
|
|
|
|
|
|
|
// As preliminary setup, we'll create two new nodes: Carol and Dave,
|
|
|
|
// such that we now have a 4 node, 3 channel topology. Dave will make a
|
|
|
|
// channel with Alice, and Carol with Dave. After this setup, the
|
|
|
|
// network topology should now look like:
|
|
|
|
// Carol -> Dave -> Alice -> Bob
|
|
|
|
//
|
|
|
|
// First, we'll create Dave and establish a channel to Alice. Dave will
|
|
|
|
// be running an older node that requires the legacy onion payload.
|
2020-07-09 00:26:05 +03:00
|
|
|
daveArgs := []string{"--protocol.legacy.onion"}
|
2021-06-07 23:05:12 +03:00
|
|
|
dave := net.NewNode(t.t, "Dave", daveArgs)
|
2020-05-04 10:47:01 +03:00
|
|
|
defer shutdownAndAssert(net, t, dave)
|
|
|
|
|
|
|
|
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
2021-06-11 07:35:30 +03:00
|
|
|
net.ConnectNodes(ctxt, t.t, dave, net.Alice)
|
2020-05-04 10:47:01 +03:00
|
|
|
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
2021-06-09 20:29:22 +03:00
|
|
|
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, dave)
|
|
|
|
|
2020-05-04 10:47:01 +03:00
|
|
|
ctxt, _ = context.WithTimeout(ctxb, channelOpenTimeout)
|
|
|
|
chanPointDave := openChannelAndAssert(
|
|
|
|
ctxt, t, net, dave, net.Alice,
|
|
|
|
lntest.OpenChannelParams{
|
|
|
|
Amt: chanAmt,
|
|
|
|
},
|
|
|
|
)
|
|
|
|
networkChans = append(networkChans, chanPointDave)
|
2021-02-13 11:05:33 +03:00
|
|
|
daveChanTXID, err := lnrpc.GetChanPointFundingTxid(chanPointDave)
|
2020-05-04 10:47:01 +03:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("unable to get txid: %v", err)
|
|
|
|
}
|
|
|
|
daveFundPoint := wire.OutPoint{
|
|
|
|
Hash: *daveChanTXID,
|
|
|
|
Index: chanPointDave.OutputIndex,
|
|
|
|
}
|
|
|
|
|
|
|
|
// Next, we'll create Carol and establish a channel to from her to
|
|
|
|
// Dave.
|
2021-06-07 23:05:12 +03:00
|
|
|
carol := net.NewNode(t.t, "Carol", nil)
|
2020-05-04 10:47:01 +03:00
|
|
|
defer shutdownAndAssert(net, t, carol)
|
|
|
|
|
|
|
|
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
2021-06-11 07:35:30 +03:00
|
|
|
net.ConnectNodes(ctxt, t.t, carol, dave)
|
2020-05-04 10:47:01 +03:00
|
|
|
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
2021-06-09 20:29:22 +03:00
|
|
|
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, carol)
|
|
|
|
|
2020-05-04 10:47:01 +03:00
|
|
|
ctxt, _ = context.WithTimeout(ctxb, channelOpenTimeout)
|
|
|
|
chanPointCarol := openChannelAndAssert(
|
|
|
|
ctxt, t, net, carol, dave,
|
|
|
|
lntest.OpenChannelParams{
|
|
|
|
Amt: chanAmt,
|
|
|
|
},
|
|
|
|
)
|
|
|
|
networkChans = append(networkChans, chanPointCarol)
|
|
|
|
|
2021-02-13 11:05:33 +03:00
|
|
|
carolChanTXID, err := lnrpc.GetChanPointFundingTxid(chanPointCarol)
|
2020-05-04 10:47:01 +03:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("unable to get txid: %v", err)
|
|
|
|
}
|
|
|
|
carolFundPoint := wire.OutPoint{
|
|
|
|
Hash: *carolChanTXID,
|
|
|
|
Index: chanPointCarol.OutputIndex,
|
|
|
|
}
|
|
|
|
|
|
|
|
// Wait for all nodes to have seen all channels.
|
|
|
|
nodes := []*lntest.HarnessNode{net.Alice, net.Bob, carol, dave}
|
|
|
|
nodeNames := []string{"Alice", "Bob", "Carol", "Dave"}
|
|
|
|
for _, chanPoint := range networkChans {
|
|
|
|
for i, node := range nodes {
|
2021-02-13 11:05:33 +03:00
|
|
|
txid, err := lnrpc.GetChanPointFundingTxid(chanPoint)
|
2020-05-04 10:47:01 +03:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("unable to get txid: %v", err)
|
|
|
|
}
|
|
|
|
point := wire.OutPoint{
|
|
|
|
Hash: *txid,
|
|
|
|
Index: chanPoint.OutputIndex,
|
|
|
|
}
|
|
|
|
|
|
|
|
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
|
|
|
err = node.WaitForNetworkChannelOpen(ctxt, chanPoint)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("%s(%d): timeout waiting for "+
|
|
|
|
"channel(%s) open: %v", nodeNames[i],
|
|
|
|
node.NodeID, point, err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Create 5 invoices for Bob, which expect a payment from Carol for 1k
|
|
|
|
// satoshis with a different preimage each time.
|
|
|
|
const numPayments = 5
|
|
|
|
const paymentAmt = 1000
|
|
|
|
payReqs, _, _, err := createPayReqs(
|
|
|
|
net.Bob, paymentAmt, numPayments,
|
|
|
|
)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("unable to create pay reqs: %v", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
// We'll wait for all parties to recognize the new channels within the
|
|
|
|
// network.
|
|
|
|
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
|
|
|
err = dave.WaitForNetworkChannelOpen(ctxt, chanPointDave)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("dave didn't advertise his channel: %v", err)
|
|
|
|
}
|
|
|
|
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
|
|
|
err = carol.WaitForNetworkChannelOpen(ctxt, chanPointCarol)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("carol didn't advertise her channel in time: %v",
|
|
|
|
err)
|
|
|
|
}
|
|
|
|
|
|
|
|
time.Sleep(time.Millisecond * 50)
|
|
|
|
|
|
|
|
// Set the fee policies of the Alice -> Bob and the Dave -> Alice
|
|
|
|
// channel edges to relatively large non default values. This makes it
|
|
|
|
// possible to pick up more subtle fee calculation errors.
|
2020-01-10 17:27:50 +03:00
|
|
|
maxHtlc := calculateMaxHtlc(chanAmt)
|
2020-07-31 11:32:33 +03:00
|
|
|
const aliceBaseFeeSat = 1
|
|
|
|
const aliceFeeRatePPM = 100000
|
2020-05-04 10:47:01 +03:00
|
|
|
updateChannelPolicy(
|
2020-07-31 11:32:33 +03:00
|
|
|
t, net.Alice, chanPointAlice, aliceBaseFeeSat*1000,
|
2020-10-06 21:56:10 +03:00
|
|
|
aliceFeeRatePPM, chainreg.DefaultBitcoinTimeLockDelta, maxHtlc,
|
2020-07-31 11:32:33 +03:00
|
|
|
carol,
|
2020-05-04 10:47:01 +03:00
|
|
|
)
|
|
|
|
|
2020-07-31 11:32:33 +03:00
|
|
|
const daveBaseFeeSat = 5
|
|
|
|
const daveFeeRatePPM = 150000
|
2020-05-04 10:47:01 +03:00
|
|
|
updateChannelPolicy(
|
2020-07-31 11:32:33 +03:00
|
|
|
t, dave, chanPointDave, daveBaseFeeSat*1000, daveFeeRatePPM,
|
2020-10-06 21:56:10 +03:00
|
|
|
chainreg.DefaultBitcoinTimeLockDelta, maxHtlc, carol,
|
2020-05-04 10:47:01 +03:00
|
|
|
)
|
|
|
|
|
2020-05-04 10:52:15 +03:00
|
|
|
// Before we start sending payments, subscribe to htlc events for each
|
|
|
|
// node.
|
|
|
|
ctxt, cancel := context.WithTimeout(ctxb, defaultTimeout)
|
|
|
|
defer cancel()
|
|
|
|
|
|
|
|
aliceEvents, err := net.Alice.RouterClient.SubscribeHtlcEvents(
|
|
|
|
ctxt, &routerrpc.SubscribeHtlcEventsRequest{},
|
|
|
|
)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("could not subscribe events: %v", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
bobEvents, err := net.Bob.RouterClient.SubscribeHtlcEvents(
|
|
|
|
ctxt, &routerrpc.SubscribeHtlcEventsRequest{},
|
|
|
|
)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("could not subscribe events: %v", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
carolEvents, err := carol.RouterClient.SubscribeHtlcEvents(
|
|
|
|
ctxt, &routerrpc.SubscribeHtlcEventsRequest{},
|
|
|
|
)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("could not subscribe events: %v", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
daveEvents, err := dave.RouterClient.SubscribeHtlcEvents(
|
|
|
|
ctxt, &routerrpc.SubscribeHtlcEventsRequest{},
|
|
|
|
)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("could not subscribe events: %v", err)
|
|
|
|
}
|
|
|
|
|
2020-05-04 10:47:01 +03:00
|
|
|
// Using Carol as the source, pay to the 5 invoices from Bob created
|
|
|
|
// above.
|
|
|
|
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
2020-03-31 13:44:18 +03:00
|
|
|
err = completePaymentRequests(
|
|
|
|
ctxt, carol, carol.RouterClient, payReqs, true,
|
|
|
|
)
|
2020-05-04 10:47:01 +03:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("unable to send payments: %v", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
// At this point all the channels within our proto network should be
|
|
|
|
// shifted by 5k satoshis in the direction of Bob, the sink within the
|
|
|
|
// payment flow generated above. The order of asserts corresponds to
|
|
|
|
// increasing of time is needed to embed the HTLC in commitment
|
|
|
|
// transaction, in channel Carol->David->Alice->Bob, order is Bob,
|
|
|
|
// Alice, David, Carol.
|
|
|
|
|
|
|
|
// The final node bob expects to get paid five times 1000 sat.
|
2020-07-31 11:32:33 +03:00
|
|
|
expectedAmountPaidAtoB := int64(numPayments * paymentAmt)
|
2020-05-04 10:47:01 +03:00
|
|
|
|
|
|
|
assertAmountPaid(t, "Alice(local) => Bob(remote)", net.Bob,
|
|
|
|
aliceFundPoint, int64(0), expectedAmountPaidAtoB)
|
|
|
|
assertAmountPaid(t, "Alice(local) => Bob(remote)", net.Alice,
|
|
|
|
aliceFundPoint, expectedAmountPaidAtoB, int64(0))
|
|
|
|
|
|
|
|
// To forward a payment of 1000 sat, Alice is charging a fee of
|
|
|
|
// 1 sat + 10% = 101 sat.
|
2020-07-31 11:32:33 +03:00
|
|
|
const aliceFeePerPayment = aliceBaseFeeSat +
|
|
|
|
(paymentAmt * aliceFeeRatePPM / 1_000_000)
|
|
|
|
const expectedFeeAlice = numPayments * aliceFeePerPayment
|
2020-05-04 10:47:01 +03:00
|
|
|
|
|
|
|
// Dave needs to pay what Alice pays plus Alice's fee.
|
|
|
|
expectedAmountPaidDtoA := expectedAmountPaidAtoB + expectedFeeAlice
|
|
|
|
|
|
|
|
assertAmountPaid(t, "Dave(local) => Alice(remote)", net.Alice,
|
|
|
|
daveFundPoint, int64(0), expectedAmountPaidDtoA)
|
|
|
|
assertAmountPaid(t, "Dave(local) => Alice(remote)", dave,
|
|
|
|
daveFundPoint, expectedAmountPaidDtoA, int64(0))
|
|
|
|
|
|
|
|
// To forward a payment of 1101 sat, Dave is charging a fee of
|
|
|
|
// 5 sat + 15% = 170.15 sat. This is rounded down in rpcserver to 170.
|
2020-07-31 11:32:33 +03:00
|
|
|
const davePaymentAmt = paymentAmt + aliceFeePerPayment
|
|
|
|
const daveFeePerPayment = daveBaseFeeSat +
|
|
|
|
(davePaymentAmt * daveFeeRatePPM / 1_000_000)
|
|
|
|
const expectedFeeDave = numPayments * daveFeePerPayment
|
2020-05-04 10:47:01 +03:00
|
|
|
|
|
|
|
// Carol needs to pay what Dave pays plus Dave's fee.
|
|
|
|
expectedAmountPaidCtoD := expectedAmountPaidDtoA + expectedFeeDave
|
|
|
|
|
|
|
|
assertAmountPaid(t, "Carol(local) => Dave(remote)", dave,
|
|
|
|
carolFundPoint, int64(0), expectedAmountPaidCtoD)
|
|
|
|
assertAmountPaid(t, "Carol(local) => Dave(remote)", carol,
|
|
|
|
carolFundPoint, expectedAmountPaidCtoD, int64(0))
|
|
|
|
|
|
|
|
// Now that we know all the balances have been settled out properly,
|
|
|
|
// we'll ensure that our internal record keeping for completed circuits
|
|
|
|
// was properly updated.
|
|
|
|
|
|
|
|
// First, check that the FeeReport response shows the proper fees
|
|
|
|
// accrued over each time range. Dave should've earned 170 satoshi for
|
|
|
|
// each of the forwarded payments.
|
|
|
|
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
|
|
|
feeReport, err := dave.FeeReport(ctxt, &lnrpc.FeeReportRequest{})
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("unable to query for fee report: %v", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if feeReport.DayFeeSum != uint64(expectedFeeDave) {
|
|
|
|
t.Fatalf("fee mismatch: expected %v, got %v", expectedFeeDave,
|
|
|
|
feeReport.DayFeeSum)
|
|
|
|
}
|
|
|
|
if feeReport.WeekFeeSum != uint64(expectedFeeDave) {
|
|
|
|
t.Fatalf("fee mismatch: expected %v, got %v", expectedFeeDave,
|
|
|
|
feeReport.WeekFeeSum)
|
|
|
|
}
|
|
|
|
if feeReport.MonthFeeSum != uint64(expectedFeeDave) {
|
|
|
|
t.Fatalf("fee mismatch: expected %v, got %v", expectedFeeDave,
|
|
|
|
feeReport.MonthFeeSum)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Next, ensure that if we issue the vanilla query for the forwarding
|
|
|
|
// history, it returns 5 values, and each entry is formatted properly.
|
|
|
|
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
|
|
|
fwdingHistory, err := dave.ForwardingHistory(
|
|
|
|
ctxt, &lnrpc.ForwardingHistoryRequest{},
|
|
|
|
)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("unable to query for fee report: %v", err)
|
|
|
|
}
|
2020-07-31 11:32:33 +03:00
|
|
|
if len(fwdingHistory.ForwardingEvents) != numPayments {
|
2020-05-04 10:47:01 +03:00
|
|
|
t.Fatalf("wrong number of forwarding event: expected %v, "+
|
2020-07-31 11:32:33 +03:00
|
|
|
"got %v", numPayments,
|
|
|
|
len(fwdingHistory.ForwardingEvents))
|
2020-05-04 10:47:01 +03:00
|
|
|
}
|
|
|
|
expectedForwardingFee := uint64(expectedFeeDave / numPayments)
|
|
|
|
for _, event := range fwdingHistory.ForwardingEvents {
|
|
|
|
// Each event should show a fee of 170 satoshi.
|
|
|
|
if event.Fee != expectedForwardingFee {
|
|
|
|
t.Fatalf("fee mismatch: expected %v, got %v",
|
|
|
|
expectedForwardingFee, event.Fee)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-04 10:52:15 +03:00
|
|
|
// We expect Carol to have successful forwards and settles for
|
|
|
|
// her sends.
|
|
|
|
assertHtlcEvents(
|
|
|
|
t, numPayments, 0, numPayments, routerrpc.HtlcEvent_SEND,
|
|
|
|
carolEvents,
|
|
|
|
)
|
|
|
|
|
|
|
|
// Dave and Alice should both have forwards and settles for
|
|
|
|
// their role as forwarding nodes.
|
|
|
|
assertHtlcEvents(
|
|
|
|
t, numPayments, 0, numPayments, routerrpc.HtlcEvent_FORWARD,
|
|
|
|
daveEvents,
|
|
|
|
)
|
|
|
|
assertHtlcEvents(
|
|
|
|
t, numPayments, 0, numPayments, routerrpc.HtlcEvent_FORWARD,
|
|
|
|
aliceEvents,
|
|
|
|
)
|
|
|
|
|
|
|
|
// Bob should only have settle events for his receives.
|
|
|
|
assertHtlcEvents(
|
|
|
|
t, 0, 0, numPayments, routerrpc.HtlcEvent_RECEIVE, bobEvents,
|
|
|
|
)
|
|
|
|
|
2020-05-04 10:47:01 +03:00
|
|
|
ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout)
|
|
|
|
closeChannelAndAssert(ctxt, t, net, net.Alice, chanPointAlice, false)
|
|
|
|
ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout)
|
|
|
|
closeChannelAndAssert(ctxt, t, net, dave, chanPointDave, false)
|
|
|
|
ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout)
|
|
|
|
closeChannelAndAssert(ctxt, t, net, carol, chanPointCarol, false)
|
|
|
|
}
|
2020-05-04 10:52:15 +03:00
|
|
|
|
|
|
|
// assertHtlcEvents consumes events from a client and ensures that they are of
|
|
|
|
// the expected type and contain the expected number of forwards, forward
|
|
|
|
// failures and settles.
|
|
|
|
func assertHtlcEvents(t *harnessTest, fwdCount, fwdFailCount, settleCount int,
|
|
|
|
userType routerrpc.HtlcEvent_EventType,
|
|
|
|
client routerrpc.Router_SubscribeHtlcEventsClient) {
|
|
|
|
|
|
|
|
var forwards, forwardFails, settles int
|
|
|
|
|
|
|
|
numEvents := fwdCount + fwdFailCount + settleCount
|
|
|
|
for i := 0; i < numEvents; i++ {
|
|
|
|
event := assertEventAndType(t, userType, client)
|
|
|
|
|
|
|
|
switch event.Event.(type) {
|
|
|
|
case *routerrpc.HtlcEvent_ForwardEvent:
|
|
|
|
forwards++
|
|
|
|
|
|
|
|
case *routerrpc.HtlcEvent_ForwardFailEvent:
|
|
|
|
forwardFails++
|
|
|
|
|
|
|
|
case *routerrpc.HtlcEvent_SettleEvent:
|
|
|
|
settles++
|
|
|
|
|
|
|
|
default:
|
|
|
|
t.Fatalf("unexpected event: %T", event.Event)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if forwards != fwdCount {
|
|
|
|
t.Fatalf("expected: %v forwards, got: %v", fwdCount, forwards)
|
|
|
|
}
|
|
|
|
|
|
|
|
if forwardFails != fwdFailCount {
|
|
|
|
t.Fatalf("expected: %v forward fails, got: %v", fwdFailCount,
|
|
|
|
forwardFails)
|
|
|
|
}
|
|
|
|
|
|
|
|
if settles != settleCount {
|
|
|
|
t.Fatalf("expected: %v settles, got: %v", settleCount, settles)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// assertEventAndType reads an event from the stream provided and ensures that
|
|
|
|
// it is associated with the correct user related type - a user initiated send,
|
|
|
|
// a receive to our node or a forward through our node. Note that this event
|
|
|
|
// type is different from the htlc event type (forward, link failure etc).
|
|
|
|
func assertEventAndType(t *harnessTest, eventType routerrpc.HtlcEvent_EventType,
|
|
|
|
client routerrpc.Router_SubscribeHtlcEventsClient) *routerrpc.HtlcEvent {
|
|
|
|
event, err := client.Recv()
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("could not get event")
|
|
|
|
}
|
|
|
|
|
|
|
|
if event.EventType != eventType {
|
|
|
|
t.Fatalf("expected: %v, got: %v", eventType,
|
|
|
|
event.EventType)
|
|
|
|
}
|
|
|
|
|
|
|
|
return event
|
|
|
|
}
|