From c0c52da0380bb8099ec974a29cc381238a082da5 Mon Sep 17 00:00:00 2001 From: Fabio Barone Date: Mon, 9 Sep 2019 15:12:12 -0500 Subject: [PATCH] swap: Windows IPC --- swap/protocol_test.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/swap/protocol_test.go b/swap/protocol_test.go index 32d94c9930..964062a051 100644 --- a/swap/protocol_test.go +++ b/swap/protocol_test.go @@ -18,15 +18,18 @@ package swap import ( "context" + "encoding/hex" "fmt" "io/ioutil" "os" "path/filepath" "reflect" + "runtime" "testing" "time" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/node" "github.com/ethereum/go-ethereum/p2p" @@ -317,6 +320,12 @@ func TestSwapRPC(t *testing.T) { swap, clean := newTestSwap(t, ownerKey) defer clean() + // use unique IPC path on windows + if runtime.GOOS == "windows" { + pubCompressed := hex.EncodeToString(crypto.CompressPubkey(swap.owner.publicKey)) + ipcPath = fmt.Sprintf(`\\.\pipe\swap-%x`, pubCompressed) + } + // need to have a dummy contract or the call will fail at `GetParams` due to `NewAPI` swap.contract, err = contract.InstanceAt(common.Address{}, swap.backend) if err != nil {