Add forfeit address in GetInfo (#326)

* keep track of forfeit transaction funds

* [btc-embedded] use p2wpkh address

* [sdk] fix clients

* use script as argument of BuildForfeitTxs
This commit is contained in:
Louis Singer
2024-09-25 13:15:44 +02:00
committed by GitHub
parent 877b7d38cd
commit 2be78b0115
33 changed files with 507 additions and 306 deletions

View File

@@ -599,6 +599,11 @@ func (s *covenantlessService) GetInfo(ctx context.Context) (*ServiceInfo, error)
return nil, fmt.Errorf("failed to get dust amount: %s", err)
}
forfeitAddr, err := s.wallet.GetForfeitAddress(ctx)
if err != nil {
return nil, fmt.Errorf("failed to get forfeit address: %s", err)
}
return &ServiceInfo{
PubKey: pubkey,
RoundLifetime: s.roundLifetime,
@@ -614,6 +619,7 @@ func (s *covenantlessService) GetInfo(ctx context.Context) (*ServiceInfo, error)
s.boardingExitDelay,
"USER",
),
ForfeitAddress: forfeitAddr,
}, nil
}
@@ -962,7 +968,7 @@ func (s *covenantlessService) startFinalization() {
minRelayFeeRate := s.wallet.MinRelayFeeRate(ctx)
if needForfeits {
connectors, forfeitTxs, err = s.builder.BuildForfeitTxs(s.pubkey, unsignedRoundTx, payments, minRelayFeeRate)
connectors, forfeitTxs, err = s.builder.BuildForfeitTxs(unsignedRoundTx, payments, minRelayFeeRate)
if err != nil {
round.Fail(fmt.Errorf("failed to create connectors and forfeit txs: %s", err))
log.WithError(err).Warn("failed to create connectors and forfeit txs")