my-cloud / ruthenium

Golang implementation of the Ruthenium protocol
The Unlicense
11 stars 1 forks source link

Sending an amount too small lead into panic #158

Closed JeremyPansier closed 1 year ago

JeremyPansier commented 1 year ago

To Reproduce Steps to reproduce the behavior:

  1. Run a node holding at least 0.00000001 Ruthenium
  2. Run a ui
  3. Send a positive amount strictly less than 0.00000001 Ruthenium to any wallet

Expected behavior Send failed with an explicit log message (amount too small).

Actual behavior Error (see comment)

JeremyPansier commented 1 year ago

stack trace:

2022/12/21 14:21:13 http: panic serving 127.0.0.1:52297: strings: negative Repeat count
goroutine 21 [running]:
net/http.(*conn).serve.func1()
    C:/Program Files/Go/src/net/http/server.go:1850 +0x148
panic({0x7ff714ea6c40, 0x7ff715062c50})
    C:/Program Files/Go/src/runtime/panic.go:890 +0x267
strings.Repeat({0x7ff714f19da2, 0x1}, 0xffffffffffffffff)
    C:/Program Files/Go/src/strings/strings.go:538 +0x26a
github.com/my-cloud/ruthenium/src/ui/server/transaction.atomsToParticles({0xc000308df0, 0xb}, 0x5f5e100)
    c:/Workspace/my-cloud/ruthenium/src/ui/server/transaction/handler.go:99 +0x294
github.com/my-cloud/ruthenium/src/ui/server/transaction.(*Handler).ServeHTTP(0xc0000a2160, {0x7ff715065c90, 0xc000136c40}, 0xc00048dc00)
    c:/Workspace/my-cloud/ruthenium/src/ui/server/transaction/handler.go:53 +0x66b
net/http.(*ServeMux).ServeHTTP(0x7ff71523f0c0, {0x7ff715065c90, 0xc000136c40}, 0xc00048dc00)
    C:/Program Files/Go/src/net/http/server.go:2487 +0x135
net/http.serverHandler.ServeHTTP({0xc0001680f0}, {0x7ff715065c90, 0xc000136c40}, 0xc00048dc00)
    C:/Program Files/Go/src/net/http/server.go:2947 +0x474
net/http.(*conn).serve(0xc000000000, {0x7ff7150660b8, 0xc000508000})
    C:/Program Files/Go/src/net/http/server.go:1991 +0x195c
created by net/http.(*Server).Serve
    C:/Program Files/Go/src/net/http/server.go:3102 +0x9e5