handleReceiveResult method

bool handleReceiveResult(
  1. SPVValidationResult result
)

Take the receive path's verdict on a BEEF this adapter delivered.

Returns true when it answered one of ours. The coordinator passes every wm.SPVValidationResult through here; results for receives this adapter did not start are left alone.

Implementation

bool handleReceiveResult(wm.SPVValidationResult result) {
  // Only a verdict on a receive this adapter started, named by the
  // correlation id it sent (bead libspiffy-l8uf). A result carrying no id,
  // or one we are not waiting for, belongs to somebody else.
  final id = result.requestId;
  if (id == null) return false;
  final waiter = _awaitingVerdict.remove(id);
  if (waiter == null) return false;
  if (!waiter.isCompleted) waiter.complete(result);
  return true;
}