docs: public int getNumberOfBytesRequiredToSpend(@Nullable ECKey pubKey, @Nullable Script redeemScript) {
          if (ScriptPattern.isP2SH(this)) {
              // scriptSig: <sig> [sig] [sig...] <redeemscript>
              checkArgument(redeemScript != null, "P2SH script requires redeemScript to be spent");
              return redeemScript.getNumberOfSignaturesRequiredToSpend() * SIG_SIZE + redeemScript.getProgram().length;
          } else if (ScriptPattern.isSentToMultisig(this)) {
              // scriptSig: OP_0 <sig> [sig] [sig...]
              return getNumberOfSignaturesRequiredToSpend() * SIG_SIZE + 1;
          } else if (ScriptPattern.isP2PK(this)) {
              // scriptSig: <sig>
              return SIG_SIZE;
          } else if (ScriptPattern.isP2PKH(this)) {
              // scriptSig: <sig> <pubkey>
              int uncompressedPubKeySize = 65; // very conservative
              return SIG_SIZE + (pubKey != null ? pubKey.getPubKey().length : uncompressedPubKeySize);
          } else if (ScriptPattern.isP2WPKH(this)) {
              // scriptSig is empty
              // witness: <sig> <pubKey>
              int compressedPubKeySize = 33;
              return SIG_SIZE + (pubKey != null ? pubKey.getPubKey().length : compressedPubKeySize);
          } else {
              throw new IllegalStateException("Unsupported script type");
          }
      }