watchtower/wtserver/server: only generate addrs for reward sessions
This commit is contained in:
parent
999cbbdc54
commit
9aa775e64e
@ -54,22 +54,27 @@ func (s *Server) handleCreateSession(peer Peer, id *wtdb.SessionID,
|
|||||||
// client. This address is to be included by the client when signing
|
// client. This address is to be included by the client when signing
|
||||||
// sweep transactions destined for this tower, if its negotiated output
|
// sweep transactions destined for this tower, if its negotiated output
|
||||||
// is not dust.
|
// is not dust.
|
||||||
rewardAddress, err := s.cfg.NewAddress()
|
var rewardScript []byte
|
||||||
if err != nil {
|
if req.BlobType.Has(blob.FlagReward) {
|
||||||
log.Errorf("unable to generate reward addr for %s", id)
|
rewardAddress, err := s.cfg.NewAddress()
|
||||||
return s.replyCreateSession(
|
if err != nil {
|
||||||
peer, id, wtwire.CodeTemporaryFailure, nil,
|
log.Errorf("Unable to generate reward addr for %s: %v",
|
||||||
)
|
id, err)
|
||||||
}
|
return s.replyCreateSession(
|
||||||
|
peer, id, wtwire.CodeTemporaryFailure, nil,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
// Construct the pkscript the client should pay to when signing justice
|
// Construct the pkscript the client should pay to when signing
|
||||||
// transactions for this session.
|
// justice transactions for this session.
|
||||||
rewardScript, err := txscript.PayToAddrScript(rewardAddress)
|
rewardScript, err = txscript.PayToAddrScript(rewardAddress)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("unable to generate reward script for %s", id)
|
log.Errorf("Unable to generate reward script for "+
|
||||||
return s.replyCreateSession(
|
"%s: %v", id, err)
|
||||||
peer, id, wtwire.CodeTemporaryFailure, nil,
|
return s.replyCreateSession(
|
||||||
)
|
peer, id, wtwire.CodeTemporaryFailure, nil,
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(conner): create invoice for upfront payment
|
// TODO(conner): create invoice for upfront payment
|
||||||
|
Loading…
Reference in New Issue
Block a user