summaryrefslogtreecommitdiff
path: root/simulation/sim-wallet.go
diff options
context:
space:
mode:
Diffstat (limited to 'simulation/sim-wallet.go')
-rw-r--r--simulation/sim-wallet.go14
1 files changed, 3 insertions, 11 deletions
diff --git a/simulation/sim-wallet.go b/simulation/sim-wallet.go
index c1a4cde..46dd5f7 100644
--- a/simulation/sim-wallet.go
+++ b/simulation/sim-wallet.go
@@ -3,7 +3,6 @@ package main
import (
"bytes"
"crypto/rand"
- "encoding/base32"
"errors"
"fmt"
"net/http"
@@ -13,7 +12,7 @@ import (
"time"
)
-const SIM_WALLET_LONG_POLL_MS_STR = "5000" // 20 seconds
+const SIM_WALLET_LONG_POLL_MS_STR = "10000" // 10 seconds
func Wallet(in chan *SimulatedPhysicalInteraction, out chan *SimulatedPhysicalInteraction, kill chan error) {
@@ -37,17 +36,10 @@ func Wallet(in chan *SimulatedPhysicalInteraction, out chan *SimulatedPhysicalIn
map[string]string{"wopid": wopid},
map[string]string{},
)
- // TODO take terminal id from uri
- parts := strings.Split(TERMINAL_USER_ID, "-")
- tid, err := strconv.Atoi(parts[1])
- if err != nil {
- kill <- err
- }
cdc := NewJsonCodec[C2ECWithdrawRegistration]()
reg := new(C2ECWithdrawRegistration)
reg.ReservePubKey = EddsaPublicKey(simulateReservePublicKey())
- reg.TerminalId = uint64(tid)
body, err := cdc.EncodeToBytes(reg)
regByte := bytes.NewBuffer(body)
// fmt.Println("WALLET : body (bytes):", regByte.Bytes())
@@ -67,7 +59,7 @@ func Wallet(in chan *SimulatedPhysicalInteraction, out chan *SimulatedPhysicalIn
kill <- err
}
- if res.StatusCode != 204 {
+ if res.StatusCode != 200 {
fmt.Println("WALLET : response status from registration:", res.StatusCode)
kill <- errors.New("failed registering the withdrawal parameters")
}
@@ -136,5 +128,5 @@ func simulateReservePublicKey() string {
if err != nil {
return ""
}
- return base32.HexEncoding.EncodeToString(mockedPubKey)
+ return talerBase32Encode(mockedPubKey)
}