将 BTC Pay Server 发票到期时间设置为永不?

Setting BTC Pay Server invoice expiration time to never?

这是 this post 的后续问题,但我的问题与编程更相关,所以我希望这是 post 它的正确位置。

我也在尝试使用 BTC Pay Server 作为钱包。有两个问题:

  1. 如文章所述,您必须在创建发票时指定金额。
  2. It has a security feature that basically results in you not being able to re-use deposit addresses.

问题 1 的解决方法是将发票金额设置为 0.000001 BTC。如此之低以至于客户总是多付钱。这对我有用。

但我的问题是地址不能过期。我检查了代码:

  1. Here 你可以看到 Invoice 对象。
  2. Here你可以看到正在使用的代码。

看来我可以使用这个:

public function setExpirationTime($expirationTime)
{
    if (is_a($expirationTime, 'DateTime')) {
        $this->expirationTime = $expirationTime;
    } else if (is_numeric($expirationTime)) {
        $expirationDateTime = new \DateTime('', new \DateTimeZone("UTC"));
        $expirationDateTime->setTimestamp($expirationTime);
        $this->expirationTime = $expirationDateTime;
    }
    return $this;
}

并将到期时间设置为 3000 年。所以我的问题是:

  1. 如果我试图使用这个地址使其永不过期,BTC 支付服务器会丢弃我的地址吗?
  2. 如果用户发送到过期地址,我是否仍会收到资金/
  3. 或者是否有更好的方法让 BTC Pay 服务器按照我的意愿充当钱包?

谢谢!

  1. Will BTC Pay server ditch my address if I attempt to use this to make it never expire?

实际上,如果 expirationTime 的类型是 DateTime,您可能会遇到 year 2038 problem。如果真的是这样,当你试图传递一个大于2038的值时,它会被设置为一个负值。接下来会发生什么还不清楚。

如果代码为运行的系统是64位的,则Y2038问题不适用。

  1. Will I still receive the funds if a user sends to an expired address

https://docs.btcpayserver.org/FAQ/FAQ-Stores/#payment-invalid-if-transactions-fails-to-confirm-minutes-after-invoice-expiration

If the customer pays the invoice, but it fails to get the defined number of confirmations within the set period, it is marked as "invalid." The merchant can then decide whether to accept the invoice afterward manually or decline it and require additional payment from the customer. This is an additional protection mechanism against the volatility

所以不完全是 - 如果它过期,您需要做一些工作才能接受它。

  1. Or is there perhaps a better way to get BTC Pay server to act as a wallet as I want it to?

与其将其设置为 3000 年,不如一次将发票设置为提前一年?