cashless2ecash

cashless2ecash: pay with cards for digital cash (experimental)
Log | Files | Refs | README

commit a2037a9fe68f64f0d630ba0e55e4d94fda2696b8
parent 4814a0c82206ed26c330bc05ffe01081b5ba8e98
Author: Joel-Haeberli <haebu@rubigen.ch>
Date:   Sun, 26 May 2024 13:57:56 +0200

fix: rename attestation to confirmation

Diffstat:
Mc2ec/c2ec-config.conf | 16++++++++++++----
Mc2ec/db.go | 2+-
Mc2ec/db/proc-c2ec_payment_notification_listener.sql | 2+-
Mc2ec/main.go | 8++++----
Mc2ec/proc-attestor.go | 4++--
Mc2ec/simulation-client.go | 8++++----
6 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/c2ec/c2ec-config.conf b/c2ec/c2ec-config.conf @@ -36,12 +36,13 @@ EXCHANGE_ACCOUNT = payto://iban/CH50030202099498 # reserves with the specified currency. CURRENCY = CHF -# How many retries shall be triggered, when the attestation -# of a transaction fails (when negative, the ) +# How many retries shall be triggered, when the confirmation +# of a transaction fails (when negative, the process tries forever) MAX_RETRIES = -1 -# How long shall the attestations retry be delayed in milliseconds at max? -# When the delay is +# How long shall the confirmations retry be delayed in milliseconds at max? +# When the delay backoff algorithm results in a higher value, this value +# is set as delay before retrying. RETRY_DELAY_MS = 1000 [wire-gateway] @@ -54,9 +55,16 @@ PASSWORD = secret CONFIG = postgres:///c2ec +# each provider gets its own provider section. +# the section name should be like 'provider-[provider_name]' [provider-wallee] +# the name of the provider must match the name of the provider in +# the database. NAME = Wallee + +# The secret must be capable of accessing the credentials, stored +# during the registration of the provider using the cli. KEY = secret [provider-simulation] diff --git a/c2ec/db.go b/c2ec/db.go @@ -155,7 +155,7 @@ type C2ECDatabase interface { // the payments. GetAttestableWithdrawals() ([]*Withdrawal, error) - // When an attestation (or fail message) could be + // When an confirmation (or fail message) could be // retrieved by the provider, the withdrawal can // be finalised storing the correct final state // and the proof of completion of the provider. diff --git a/c2ec/db/proc-c2ec_payment_notification_listener.sql b/c2ec/db/proc-c2ec_payment_notification_listener.sql @@ -29,7 +29,7 @@ COMMENT ON FUNCTION emit_payment_notification and the provider_transaction_id, on the channel "payment_notification". The format of the payload is as follows: "{PROVIDER_NAME}|{WITHDRAWAL_ID}|{PROVIDER_TRANSACTION_ID}". The subscriber - shall decide which attestation process to use, based on the name of + shall decide which confirmation process to use, based on the name of the provider.'; -- for creating a trigger the user must have TRIGGER pivilege on the table. diff --git a/c2ec/main.go b/c2ec/main.go @@ -117,9 +117,9 @@ func main() { // since listening for incoming request, attesting payments and // retrying payments are separated processes who can fail // we must take care of this here. The main process is used to - // dispatch incoming http request and parent of the attestation + // dispatch incoming http request and parent of the confirmation // and retry processes. If the main process fails somehow, also - // attestation and retries will end. But if somehow the attestation + // confirmation and retries will end. But if somehow the confirmation // or retry process fail, they will be restarted and the error is // written to the log. If some setup tasks are failing, the program // panics. @@ -143,8 +143,8 @@ func main() { transferCancel() // first run old cancellation function transferCtx, transferCancel = context.WithCancel(context.Background()) RunTransferrer(transferCtx, transferErrs) - case attestationError := <-attestorErrs: - LogError("main-from-proc-attestor", attestationError) + case confirmationError := <-attestorErrs: + LogError("main-from-proc-attestor", confirmationError) case retryError := <-retryErrs: LogError("main-from-proc-retrier", retryError) case transferError := <-transferErrs: diff --git a/c2ec/proc-attestor.go b/c2ec/proc-attestor.go @@ -22,13 +22,13 @@ func RunAttestor( go RunListener( ctx, PS_PAYMENT_NOTIFICATION_CHANNEL, - attestationCallback, + confirmationCallback, make(chan *Notification, PAYMENT_NOTIFICATION_CHANNEL_BUFFER_SIZE), errs, ) } -func attestationCallback(notification *Notification, errs chan error) { +func confirmationCallback(notification *Notification, errs chan error) { LogInfo("proc-attestor", fmt.Sprintf("retrieved information on channel=%s with payload=%s", notification.Channel, notification.Payload)) diff --git a/c2ec/simulation-client.go b/c2ec/simulation-client.go @@ -18,8 +18,8 @@ type SimulationClient struct { // toggle this to simulate failed transactions. AllowNextWithdrawal bool - // simulates the provider client fetching attestation at the providers backend. - providerBackendAttestationDelayMs int + // simulates the provider client fetching confirmation at the providers backend. + providerBackendConfirmationDelayMs int } func (st *SimulationTransaction) AllowWithdrawal() bool { @@ -53,7 +53,7 @@ func (sc *SimulationClient) SetupClient(p *Provider) error { fmt.Println("setting up simulation client. probably not what you want in production") sc.AllowNextWithdrawal = true - sc.providerBackendAttestationDelayMs = 1000 // one second, might be a lot but for testing this is fine. + sc.providerBackendConfirmationDelayMs = 1000 // one second, might be a lot but for testing this is fine. PROVIDER_CLIENTS["Simulation"] = sc return nil } @@ -61,7 +61,7 @@ func (sc *SimulationClient) SetupClient(p *Provider) error { func (sc *SimulationClient) GetTransaction(transactionId string) (ProviderTransaction, error) { LogInfo("simulation-client", "getting transaction from simulation provider") - time.Sleep(time.Duration(sc.providerBackendAttestationDelayMs) * time.Millisecond) + time.Sleep(time.Duration(sc.providerBackendConfirmationDelayMs) * time.Millisecond) st := new(SimulationTransaction) st.allow = sc.AllowNextWithdrawal return st, nil