itest: fix endorsement itests

Due to the signaling period expiring tests had to be adopted bc
they were not taking the activation time period into account.
This commit is contained in:
ziggie committed 2026-01-05 14:28:14 +01:00
1 parent 013f5c93ed
commit 5f30797738
3 files changed
+50 -11

No files matched your search

+17
View File
@@ -7,9 +7,11 @@ import (
"os"
"strconv"
"strings"
"time"
"github.com/btcsuite/btcd/btcutil"
"github.com/btcsuite/btcd/wire"
"github.com/lightningnetwork/lnd"
"github.com/lightningnetwork/lnd/input"
"github.com/lightningnetwork/lnd/lnrpc"
"github.com/lightningnetwork/lnd/lntest/wait"
@@ -288,6 +290,15 @@ func CalcStaticFeeBuffer(c lnrpc.CommitmentType, numHTLCs int) btcutil.Amount {
func CustomRecordsWithUnendorsed(
originalRecords lnwire.CustomRecords) map[uint64][]byte {
if !ExperimentalEndorsementActive() {
// Return nil if there are no records, to match wire encoding.
if len(originalRecords) == 0 {
return nil
}
return originalRecords.Copy()
}
return originalRecords.MergedCopy(map[uint64][]byte{
uint64(lnwire.ExperimentalEndorsementType): {
lnwire.ExperimentalUnendorsed,
@@ -295,6 +306,12 @@ func CustomRecordsWithUnendorsed(
)
}
// ExperimentalEndorsementActive returns true if the experimental endorsement
// window is still open.
func ExperimentalEndorsementActive() bool {
return time.Now().Before(lnd.EndorsementExperimentEnd)
}
// LnrpcOutpointToStr returns a string representation of an lnrpc.OutPoint.
func LnrpcOutpointToStr(outpoint *lnrpc.OutPoint) string {
return fmt.Sprintf("%s:%d", outpoint.TxidStr, outpoint.OutputIndex)