Skip to content

hook: Always consume stdin for reference transaction hook

Patrick Steinhardt requested to merge pks-hook-test-race into master

Based on the current transaction state, the reference transaction hook may choose to completely ignore all of the standard input. That's mostly fine as it wouldn't be processed by anything anyway, but it may tick off callers which try to first send over all of their standard input.

One such caller is our test suite, which verifies that it may always send over all of standard input without an error. This is creating a race between sender and receiver: if the receiver closes the channel fast enough, the reference transaction hook test may fail with a "Closed" error for any state which isn't "prepared".

Let's just consume all of standard input in all cases. While it may seem wasteful, it's also what we've traditionally been doing with other hooks.


Fixes #3237 (closed)

Note that this is not a real bug, at least I don't think it is. On the other hand, consuming stdin shouldn't be harmful and it's what we do for other hook RPCs as well, even if we ignore it afterwards.

Edited by Patrick Steinhardt

Merge request reports

Loading