signrawtransaction doesn't handle non-existing input properly #10

Closed
opened 2022-08-04 08:25:44 +02:00 by roylee17 · 0 comments
roylee17 commented 2022-08-04 08:25:44 +02:00 (Migrated from github.com)

To reproduce:

Create a transaction with non-existing input:

lbcctl --wallet --skipverify createrawtransaction 
'[{"txid":"5a21c2c92ea94a1843236eed9c7b4fbcbddba859bec5e1f20fc03e8012da7d2d","vout":0}]' '{"bYg4Jc9Bitk6YiMSAVAokUbgth8BT4dsPv":0.001}'

01000000012d7dda12803ec00ff2e1c5be59a8dbbdbc4f7b9ced6e2343184aa92ec9c2215a0000000000ffffffff01a0860100000000001976a914dac6ecd2178a5a693ca65760cb9437cfe74a82a488ac00000000
lbcctl --wallet --skipverify signrawtransaction 01000000012d7dda12803ec00ff2e1c5be59a8dbbdbc4f7b9ced6e2343184aa92ec9c2215a0000000000ffffffff01a0860100000000001976a914dac6ecd2178a5a693ca65760cb9437cfe74a82a488ac00000000

Post "https://localhost:9244": EOF

Log on lbcwallet

2022/08/03 23:22:48 http: panic serving [::1]:57257: runtime error: invalid memory address or nil pointer dereference
goroutine 13 [running]:
net/http.(*conn).serve.func1()
        /usr/local/Cellar/go/1.18.4/libexec/src/net/http/server.go:1825 +0xbf
panic({0x4a08c60, 0x53706c0})
        /usr/local/Cellar/go/1.18.4/libexec/src/runtime/panic.go:844 +0x258
github.com/lbryio/lbcwallet/rpc/legacyrpc.signRawTransaction({0x498be60?, 0xc0005d4960}, 0xc00036c480, 0xc0005ce000)
        /Users/roylee17/Repos/work/lbcwallet/rpc/legacyrpc/methods.go:1864 +0x8ee
github.com/lbryio/lbcwallet/rpc/legacyrpc.lazyApplyHandler.func1()
        /Users/roylee17/Repos/work/lbcwallet/rpc/legacyrpc/methods.go:177 +0x82
github.com/lbryio/lbcwallet/rpc/legacyrpc.(*Server).postClientRPC(0xc0000dd880?, {0x4dc5330?, 0xc00082c000}, 0xc?)
        /Users/roylee17/Repos/work/lbcwallet/rpc/legacyrpc/server.go:598 +0x1cd
github.com/lbryio/lbcwallet/rpc/legacyrpc.NewServer.func2({0x4dc5330, 0xc00082c000}, 0xc000a40100)
        /Users/roylee17/Repos/work/lbcwallet/rpc/legacyrpc/server.go:127 +0x225
net/http.HandlerFunc.ServeHTTP(0xc00082c040?, {0x4dc5330?, 0xc00082c000?}, 0x4492825?)
        /usr/local/Cellar/go/1.18.4/libexec/src/net/http/server.go:2084 +0x2f
github.com/lbryio/lbcwallet/rpc/legacyrpc.throttled.func1({0x4dc5330?, 0xc00082c000?}, 0x8eff1e8dd?)
        /Users/roylee17/Repos/work/lbcwallet/rpc/legacyrpc/server.go:331 +0x151
net/http.HandlerFunc.ServeHTTP(0x69be604dd?, {0x4dc5330?, 0xc00082c000?}, 0x406bb56?)
        /usr/local/Cellar/go/1.18.4/libexec/src/net/http/server.go:2084 +0x2f
net/http.(*ServeMux).ServeHTTP(0x0?, {0x4dc5330, 0xc00082c000}, 0xc000a40100)
        /usr/local/Cellar/go/1.18.4/libexec/src/net/http/server.go:2462 +0x149
net/http.serverHandler.ServeHTTP({0x4dc2458?}, {0x4dc5330, 0xc00082c000}, 0xc000a40100)
        /usr/local/Cellar/go/1.18.4/libexec/src/net/http/server.go:2916 +0x43b
net/http.(*conn).serve(0xc00050a140, {0x4dc5d40, 0xc000510090})
        /usr/local/Cellar/go/1.18.4/libexec/src/net/http/server.go:1966 +0x5d7
created by net/http.(*Server).Serve
        /usr/local/Cellar/go/1.18.4/libexec/src/net/http/server.go:3071 +0x4db
To reproduce: Create a transaction with non-existing input: ``` lbcctl --wallet --skipverify createrawtransaction '[{"txid":"5a21c2c92ea94a1843236eed9c7b4fbcbddba859bec5e1f20fc03e8012da7d2d","vout":0}]' '{"bYg4Jc9Bitk6YiMSAVAokUbgth8BT4dsPv":0.001}' 01000000012d7dda12803ec00ff2e1c5be59a8dbbdbc4f7b9ced6e2343184aa92ec9c2215a0000000000ffffffff01a0860100000000001976a914dac6ecd2178a5a693ca65760cb9437cfe74a82a488ac00000000 ``` ``` lbcctl --wallet --skipverify signrawtransaction 01000000012d7dda12803ec00ff2e1c5be59a8dbbdbc4f7b9ced6e2343184aa92ec9c2215a0000000000ffffffff01a0860100000000001976a914dac6ecd2178a5a693ca65760cb9437cfe74a82a488ac00000000 Post "https://localhost:9244": EOF ``` Log on lbcwallet ``` 2022/08/03 23:22:48 http: panic serving [::1]:57257: runtime error: invalid memory address or nil pointer dereference goroutine 13 [running]: net/http.(*conn).serve.func1() /usr/local/Cellar/go/1.18.4/libexec/src/net/http/server.go:1825 +0xbf panic({0x4a08c60, 0x53706c0}) /usr/local/Cellar/go/1.18.4/libexec/src/runtime/panic.go:844 +0x258 github.com/lbryio/lbcwallet/rpc/legacyrpc.signRawTransaction({0x498be60?, 0xc0005d4960}, 0xc00036c480, 0xc0005ce000) /Users/roylee17/Repos/work/lbcwallet/rpc/legacyrpc/methods.go:1864 +0x8ee github.com/lbryio/lbcwallet/rpc/legacyrpc.lazyApplyHandler.func1() /Users/roylee17/Repos/work/lbcwallet/rpc/legacyrpc/methods.go:177 +0x82 github.com/lbryio/lbcwallet/rpc/legacyrpc.(*Server).postClientRPC(0xc0000dd880?, {0x4dc5330?, 0xc00082c000}, 0xc?) /Users/roylee17/Repos/work/lbcwallet/rpc/legacyrpc/server.go:598 +0x1cd github.com/lbryio/lbcwallet/rpc/legacyrpc.NewServer.func2({0x4dc5330, 0xc00082c000}, 0xc000a40100) /Users/roylee17/Repos/work/lbcwallet/rpc/legacyrpc/server.go:127 +0x225 net/http.HandlerFunc.ServeHTTP(0xc00082c040?, {0x4dc5330?, 0xc00082c000?}, 0x4492825?) /usr/local/Cellar/go/1.18.4/libexec/src/net/http/server.go:2084 +0x2f github.com/lbryio/lbcwallet/rpc/legacyrpc.throttled.func1({0x4dc5330?, 0xc00082c000?}, 0x8eff1e8dd?) /Users/roylee17/Repos/work/lbcwallet/rpc/legacyrpc/server.go:331 +0x151 net/http.HandlerFunc.ServeHTTP(0x69be604dd?, {0x4dc5330?, 0xc00082c000?}, 0x406bb56?) /usr/local/Cellar/go/1.18.4/libexec/src/net/http/server.go:2084 +0x2f net/http.(*ServeMux).ServeHTTP(0x0?, {0x4dc5330, 0xc00082c000}, 0xc000a40100) /usr/local/Cellar/go/1.18.4/libexec/src/net/http/server.go:2462 +0x149 net/http.serverHandler.ServeHTTP({0x4dc2458?}, {0x4dc5330, 0xc00082c000}, 0xc000a40100) /usr/local/Cellar/go/1.18.4/libexec/src/net/http/server.go:2916 +0x43b net/http.(*conn).serve(0xc00050a140, {0x4dc5d40, 0xc000510090}) /usr/local/Cellar/go/1.18.4/libexec/src/net/http/server.go:1966 +0x5d7 created by net/http.(*Server).Serve /usr/local/Cellar/go/1.18.4/libexec/src/net/http/server.go:3071 +0x4db ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: LBRYCommunity/lbcwallet#10
No description provided.