Skip to content

ipc: crash on submitSolution call with invalid coinbase #33341

@marcofleon

Description

@marcofleon

There seems to be an unhandled exception when deserializing an invalid coinbase in submitSolution.

log
node0 2025-09-08T11:26:56.165687Z [capnp-loop] [../../../src/ipc/capnp/protocol.cpp:35] [void ipc::capnp::(anonymous namespace)::IpcLogFn(bool, std::string)] [ipc] {bitcoin-node-166995/b-capnp-loop-166997} IPC server recv request  #14 BlockTemplate.submitSolution$Params (context = (thread = <external capability>), version = 0, timestamp = 0, nonce = 0, coinbase = "") 
 node0 2025-09-08T11:26:56.165711Z [capnp-loop] [../../../src/ipc/capnp/protocol.cpp:35] [void ipc::capnp::(anonymous namespace)::IpcLogFn(bool, std::string)] [ipc] {bitcoin-node-166995/b-capnp-loop-166997} IPC server post request  #14 {bitcoin-node-166995/b-capnp-loop-167036 (from pythread)} 
 test  2025-09-08T11:26:56.207859Z TestFramework (ERROR): Unexpected exception 
                                   Traceback (most recent call last):
                                     File "/root/bitcoin/test/functional/test_framework/test_framework.py", line 199, in main
                                       self.run_test()
                                     File "/root/bitcoin/./debugbuild/test/functional/interface_ipc.py", line 186, in run_test
                                       self.run_mining_test()
                                     File "/root/bitcoin/./debugbuild/test/functional/interface_ipc.py", line 182, in run_mining_test
                                       asyncio.run(capnp.run(async_routine()))
                                     File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run
                                       return runner.run(main)
                                              ^^^^^^^^^^^^^^^^
                                     File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run
                                       return self._loop.run_until_complete(task)
                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                     File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
                                       return future.result()
                                              ^^^^^^^^^^^^^^^
                                     File "capnp/lib/capnp.pyx", line 1965, in run
                                     File "capnp/lib/capnp.pyx", line 1966, in capnp.lib.capnp.run
                                     File "/root/bitcoin/./debugbuild/test/functional/interface_ipc.py", line 128, in async_routine
                                       result = await template.result.submitSolution(ctx, 0, 0, 0, b"")
                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                   capnp.lib.capnp.KjException: capnp/rpc.c++:2778: disconnected: Peer disconnected.
                                   stack: 7fd1cba914c4 7fd1cba87d10 7fd1cba777c0 7fd1cb9164f0 7fd1cb9187d0
 test  2025-09-08T11:26:56.218026Z TestFramework (DEBUG): Closing down network thread 
 test  2025-09-08T11:26:56.268255Z TestFramework (INFO): Not stopping nodes as test failed. The dangling processes will be cleaned up later. 
 test  2025-09-08T11:26:56.268354Z TestFramework (WARNING): Not cleaning up dir /tmp/bitcoin_func_test_jp4hfh13 
 test  2025-09-08T11:26:56.268384Z TestFramework (ERROR): Test failed. Test logging available at /tmp/bitcoin_func_test_jp4hfh13/test_framework.log 
 test  2025-09-08T11:26:56.268453Z TestFramework (ERROR): 
 test  2025-09-08T11:26:56.268517Z TestFramework (ERROR): Hint: Call /root/bitcoin/test/functional/combine_logs.py '/tmp/bitcoin_func_test_jp4hfh13' to consolidate all logs 
 test  2025-09-08T11:26:56.268547Z TestFramework (ERROR): 
 test  2025-09-08T11:26:56.268569Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log. 
 test  2025-09-08T11:26:56.268603Z TestFramework (ERROR): https://github.com/bitcoin/bitcoin/issues 
 test  2025-09-08T11:26:56.268627Z TestFramework (ERROR): 

 node0 stderr terminate called after throwing an instance of 'std::ios_base::failure[abi:cxx11]'
  what():  SpanReader::read(): end of data: iostream error 

I found this while using fuzzamoto to test the mining interface, but the easiest way to reproduce would be to just add

await template.result.submitSolution(ctx, 0, 0, 0, b"")

after creating the block template in the IPC functional test (interface_ipc.py).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions