Merge bitcoin/bitcoin#34807: kernel: doc: explain return value for btck_WriteBytes callback

ec4ec91d59b25badf212bf0aee0ad5c1eead7ff1 kernel: doc: explain return value for `btck_WriteBytes` callback (Sebastian Falbesoner)

Pull request description:

  Note that this is the only callback type with a non-void return type. Probably it would make sense to document the parameters of callbacks as well on the long-term (Doxygen style?), but this IMHO the most critical missing documentation, where likely other bitcoinkernel users working with the C API could trip over too.

  Background: I've been working on btck bindings for [Zig](https://ziglang.org/) for a while [1]. Overall I found the C API header `bitcoinkernel.h` very well-documented and to a large degree self-explanatory, but for implementing a `btck_WriteBytes` callback (needed for various `btck_..._to_bytes` serialization functions) I had to look into the [kernel implementation](e98d36715e/src/kernel/bitcoinkernel.cpp (L86)) to figure out what return value is expected.

  [1] still not public and put on hold for the last few months due to lib(std)c++ build system / linking issues (needing ugly workarounds, hopefully improved with Zig's upcoming 0.16 release); now continued, hopefully ready to be published in a first presentable version soon(tm)

ACKs for top commit:
  sedited:
    ACK ec4ec91d59b25badf212bf0aee0ad5c1eead7ff1
  alexanderwiederin:
    ACK ec4ec91d59
  stickies-v:
    ACK ec4ec91d59b25badf212bf0aee0ad5c1eead7ff1

Tree-SHA512: aeea68474a04e0bc4d2421a0539a0bd717b0526f58c7379848a8bb8cb75a0fdf5c94bfcc226f28dd09b89c5fc368921d1d875893b86680e7c51d7b98f4ab749d
This commit is contained in:
merge-script 2026-03-12 08:40:52 +00:00
commit 2efb8c44bb
No known key found for this signature in database
GPG Key ID: 2EEB9F5CC09526C1

View File

@ -349,6 +349,8 @@ typedef void (*btck_ValidationInterfaceBlockDisconnected)(void* user_data, btck_
/**
* Function signature for serializing data.
*
* Returns 0 to indicate success.
*/
typedef int (*btck_WriteBytes)(const void* bytes, size_t size, void* userdata);