watchtower/wtserver/server: no ack updates

This commit is contained in:
Conner Fromknecht 2019-03-15 02:33:20 -07:00
parent 8b0cc487f0
commit a222a63d81
No known key found for this signature in database
GPG Key ID: E7D737B67FA592C7

@ -55,6 +55,10 @@ type Config struct {
// ChainHash identifies the network that the server is watching.
ChainHash chainhash.Hash
// NoAckUpdates causes the server to not acknowledge state updates, this
// should only be used for testing.
NoAckUpdates bool
}
// Server houses the state required to handle watchtower peers. It's primary job
@ -445,6 +449,13 @@ func (s *Server) handleStateUpdate(peer Peer, id *wtdb.SessionID,
failCode = wtwire.CodeTemporaryFailure
}
if s.cfg.NoAckUpdates {
return &connFailure{
ID: *id,
Code: uint16(failCode),
}
}
return s.replyStateUpdate(
peer, id, failCode, lastApplied,
)