From 575eaf75acc0f5121c786779f72d47c2fae640e7 Mon Sep 17 00:00:00 2001 From: ffranr Date: Thu, 7 Sep 2023 15:21:38 +0100 Subject: [PATCH 1/2] multi: rename courier type ApertureCourier to HashmailCourierType --- itest/tapd_harness.go | 2 +- itest/test_harness.go | 2 +- itest/test_list_on_test.go | 10 +++++----- proof/courier.go | 13 +++++-------- tapcfg/config.go | 2 +- tapcfg/server.go | 2 +- 6 files changed, 14 insertions(+), 17 deletions(-) diff --git a/itest/tapd_harness.go b/itest/tapd_harness.go index 0bd3ba507..3d722ffea 100644 --- a/itest/tapd_harness.go +++ b/itest/tapd_harness.go @@ -169,7 +169,7 @@ func newTapdHarness(t *testing.T, ht *harnessTest, cfg tapdConfig, } finalCfg.DefaultProofCourierAddr = fmt.Sprintf( - "%s://%s", proof.ApertureCourier, + "%s://%s", proof.HashmailCourierType, typedProofCourier.ListenAddr, ) diff --git a/itest/test_harness.go b/itest/test_harness.go index ced23487f..77825bcb7 100644 --- a/itest/test_harness.go +++ b/itest/test_harness.go @@ -280,7 +280,7 @@ func setupHarnesses(t *testing.T, ht *harnessTest, case proof.DisabledCourier: // Proof courier disabled, do nothing. - case proof.ApertureCourier: + case proof.HashmailCourierType: port := nextAvailablePort() apHarness := NewApertureHarness(ht.t, port) proofCourier = &apHarness diff --git a/itest/test_list_on_test.go b/itest/test_list_on_test.go index ebd04483a..4c1a78156 100644 --- a/itest/test_list_on_test.go +++ b/itest/test_list_on_test.go @@ -41,27 +41,27 @@ var testCases = []*testCase{ { name: "basic send unidirectional", test: testBasicSendUnidirectional, - proofCourierType: proof.ApertureCourier, + proofCourierType: proof.HashmailCourierType, }, { name: "resume pending package send", test: testResumePendingPackageSend, - proofCourierType: proof.ApertureCourier, + proofCourierType: proof.HashmailCourierType, }, { name: "reattempt failed asset send", test: testReattemptFailedAssetSend, - proofCourierType: proof.ApertureCourier, + proofCourierType: proof.HashmailCourierType, }, { name: "offline receiver eventually receives", test: testOfflineReceiverEventuallyReceives, - proofCourierType: proof.ApertureCourier, + proofCourierType: proof.HashmailCourierType, }, { name: "basic send passive asset", test: testBasicSendPassiveAsset, - proofCourierType: proof.ApertureCourier, + proofCourierType: proof.HashmailCourierType, }, { name: "send multiple coins", diff --git a/proof/courier.go b/proof/courier.go index b86f3ecca..ba4fa6b10 100644 --- a/proof/courier.go +++ b/proof/courier.go @@ -31,12 +31,9 @@ const ( // courier is specified. DisabledCourier CourierType = "disabled_courier" - // ApertureCourier is a courier that uses the hashmail protocol to + // HashmailCourierType is a courier that uses the hashmail protocol to // deliver proofs. - // - // TODO(ffranr): Rename to HashmailCourier (use protocol name rather - // than service). - ApertureCourier = "hashmail" + HashmailCourierType = "hashmail" ) // CourierHarness interface is an integration testing harness for a proof @@ -98,7 +95,7 @@ func ParseCourierAddrString(addr string) (CourierAddr, error) { func ParseCourierAddrUrl(addr url.URL) (CourierAddr, error) { // Create new courier addr based on URL scheme. switch addr.Scheme { - case ApertureCourier: + case HashmailCourierType: return NewHashMailCourierAddr(addr) } @@ -148,7 +145,7 @@ func (h *HashMailCourierAddr) NewCourier(_ context.Context, cfg *CourierCfg, // URL. This function also performs hashmail protocol specific address // validation. func NewHashMailCourierAddr(addr url.URL) (*HashMailCourierAddr, error) { - if addr.Scheme != ApertureCourier { + if addr.Scheme != HashmailCourierType { return nil, fmt.Errorf("expected hashmail courier protocol: %v", addr.Scheme) } @@ -244,7 +241,7 @@ func serverDialOpts() ([]grpc.DialOption, error) { func NewHashMailBox(courierAddr *url.URL) (*HashMailBox, error) { - if courierAddr.Scheme != ApertureCourier { + if courierAddr.Scheme != HashmailCourierType { return nil, fmt.Errorf("unsupported courier protocol: %v", courierAddr.Scheme) } diff --git a/tapcfg/config.go b/tapcfg/config.go index bf1db1787..0a3776bcf 100644 --- a/tapcfg/config.go +++ b/tapcfg/config.go @@ -340,7 +340,7 @@ func DefaultConfig() Config { BatchMintingInterval: defaultBatchMintingInterval, ReOrgSafeDepth: defaultReOrgSafeDepth, DefaultProofCourierAddr: fmt.Sprintf( - "%s://%s", proof.ApertureCourier, fallbackHashMailAddr, + "%s://%s", proof.HashmailCourierType, fallbackHashMailAddr, ), HashMailCourier: &proof.HashMailCourierCfg{ ReceiverAckTimeout: defaultProofTransferReceiverAckTimeout, diff --git a/tapcfg/server.go b/tapcfg/server.go index acba44652..81f16fdcc 100644 --- a/tapcfg/server.go +++ b/tapcfg/server.go @@ -159,7 +159,7 @@ func genServerConfig(cfg *Config, cfgLogger btclog.Logger, // If no default proof courier address is set, use the fallback hashmail // address. fallbackHashmailCourierAddr := fmt.Sprintf( - "%s://%s", proof.ApertureCourier, fallbackHashMailAddr, + "%s://%s", proof.HashmailCourierType, fallbackHashMailAddr, ) proofCourierAddr, err := proof.ParseCourierAddrString( fallbackHashmailCourierAddr, From 19930a90dd742ffac16238c0feddee96c19c49a2 Mon Sep 17 00:00:00 2001 From: ffranr Date: Thu, 7 Sep 2023 15:31:08 +0100 Subject: [PATCH 2/2] proof: remove CourierType rename TODO, enhance doc --- proof/courier.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/proof/courier.go b/proof/courier.go index ba4fa6b10..9abc876ed 100644 --- a/proof/courier.go +++ b/proof/courier.go @@ -20,10 +20,8 @@ import ( "google.golang.org/grpc/status" ) -// CourierType is an enum that represents the different types of proof courier -// services. -// -// TODO(ffranr): Rename to CourierProtocol. +// CourierType is an enum that represents the different proof courier services +// protocols that are supported. type CourierType string const (