gcash/bchwallet

Signing a raw transaction returns EOF

Closed this issue · 3 comments

Creating a simple one input, one output raw transaction and then trying to sign it with Using bchctl --wallet signrawtransaction $RAWTX returns Post https://localhost:8332: EOF

Issue is fixed. Was caused by the input already being spent. Should merge soon.

The fix has merged. Let me know if you have any issues. =)

I recompiled from master but this didn't fix the problem. The selected input is unspent.

RAWTX=$(bchctl createrawtransaction '[{"txid":"'$TXID'","vout":0,"sequence":123456789}]' '{"'$ADDRESS'":0.01}')
bchctl --wallet signrawtransaction $RAWTX

trace:

http: panic serving [::1]:56812: runtime error: index out of range
goroutine 42 [running]:
net/http.(*conn).serve.func1(0x1d96060)
        /usr/local/go/src/net/http/server.go:1769 +0xf0
panic(0x7495b8, 0xfa6390)
        /usr/local/go/src/runtime/panic.go:522 +0x1a0
github.com/gcash/bchwallet/wallet.(*Wallet).SignTransaction.func1(0xa5d228, 0x1c10f18, 0x1c10f18, 0x0)
        /home/pi/go/src/github.com/gcash/bchwallet/wallet/wallet.go:3356 +0x888
github.com/gcash/bchwallet/walletdb.View(0xa61158, 0x1ccc360, 0x1d15728, 0x4ba5f4, 0x0)
        /home/pi/go/src/github.com/gcash/bchwallet/walletdb/interface.go:203 +0x58
github.com/gcash/bchwallet/wallet.(*Wallet).SignTransaction(0x204a460, 0x1d15934, 0x0, 0x0, 0x0, 0x1, 0x1d15918, 0x0, 0x2021560, 0xd8ddf958, ...)
        /home/pi/go/src/github.com/gcash/bchwallet/wallet/wallet.go:3274 +0xa4
github.com/gcash/bchwallet/rpc/legacyrpc.signRawTransaction(0x6d87b0, 0x2021500, 0x204a460, 0x1e78040, 0x0, 0xa66be0, 0x1e78040, 0x20214e0)
        /home/pi/go/src/github.com/gcash/bchwallet/rpc/legacyrpc/methods.go:1727 +0x494
github.com/gcash/bchwallet/rpc/legacyrpc.lazyApplyHandler.func1(0x1ccc240, 0x1c9e420, 0x20214e0)
        /home/pi/go/src/github.com/gcash/bchwallet/rpc/legacyrpc/methods.go:178 +0x100
github.com/gcash/bchwallet/rpc/legacyrpc.(*Server).postClientRPC(0x1ccc240, 0xa5fcf8, 0x237a090, 0x1e74080)
        /home/pi/go/src/github.com/gcash/bchwallet/rpc/legacyrpc/server.go:609 +0x38c
github.com/gcash/bchwallet/rpc/legacyrpc.NewServer.func2(0xa5fcf8, 0x237a090, 0x1e74080)
        /home/pi/go/src/github.com/gcash/bchwallet/rpc/legacyrpc/server.go:129 +0x26c
net/http.HandlerFunc.ServeHTTP(0x1c10d50, 0xa5fcf8, 0x237a090, 0x1e74080)
        /usr/local/go/src/net/http/server.go:1995 +0x34
github.com/gcash/bchwallet/rpc/legacyrpc.throttled.func1(0xa5fcf8, 0x237a090, 0x1e74080)
        /home/pi/go/src/github.com/gcash/bchwallet/rpc/legacyrpc/server.go:333 +0x1d8
net/http.HandlerFunc.ServeHTTP(0x2020aa0, 0xa5fcf8, 0x237a090, 0x1e74080)
        /usr/local/go/src/net/http/server.go:1995 +0x34
net/http.(*ServeMux).ServeHTTP(0x1c9e090, 0xa5fcf8, 0x237a090, 0x1e74080)
        /usr/local/go/src/net/http/server.go:2375 +0x1ac
net/http.serverHandler.ServeHTTP(0x1ccc240, 0xa5fcf8, 0x237a090, 0x1e74080)
        /usr/local/go/src/net/http/server.go:2774 +0x88
net/http.(*conn).serve(0x1d96060, 0xa60b78, 0x2021220)
        /usr/local/go/src/net/http/server.go:1878 +0x7e4
created by net/http.(*Server).Serve
        /usr/local/go/src/net/http/server.go:2884 +0x29