checkBroadcastSuitability method

  1. @override
Future<MaybeInputsOwned> checkBroadcastSuitability({
  1. BigInt? minFeeRate,
  2. required FutureOr<bool> canBroadcast(
    1. Uint8List p1
    ),
  3. dynamic hint,
})

Call after checking that the Original PSBT can be broadcast. Receiver MUST check that the Original PSBT from the sender can be broadcast, i.e. testmempoolaccept bitcoind rpc returns { “allowed”: true,.. } for gettransactiontocheckbroadcast() before calling this method. Do this check if you generate bitcoin uri to receive Payjoin on sender request without manual human approval, like a payment processor. Such so called “non-interactive” receivers are otherwise vulnerable to probing attacks. If a sender can make requests at will, they can learn which bitcoin the receiver owns at no cost. Broadcasting the Original PSBT after some time in the failure case makes incurs sender cost and prevents probing. Call this after checking downstream.

Implementation

@override
Future<MaybeInputsOwned> checkBroadcastSuitability(
    {BigInt? minFeeRate,
    required FutureOr<bool> Function(Uint8List p1) canBroadcast,
    hint}) async {
  try {
    final res = await super.checkBroadcastSuitability(
        minFeeRate: minFeeRate, canBroadcast: canBroadcast);
    return MaybeInputsOwned._(field0: res.field0);
  } on error.PayjoinError catch (e) {
    throw mapPayjoinError(e);
  }
}