Skip to content

Commit

Permalink
option to disable preimage checking (at least until we don't get a le…
Browse files Browse the repository at this point in the history
…aner way to grab these preimages like a dedicated preimage parser service).
  • Loading branch information
fiatjaf committed Oct 3, 2022
1 parent 2fc614e commit 591b181
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,15 @@ No configuration is needed for a quick test, but you can write a file at `$LIGHT
"isDev": true, // controls log level and where are logs displayed

"requireSecret": false, // setting this to true will make it so only clients with this secret can get hosted channels
"permanentSecrets": [] // you can specify static secrets here that can be used by clients when "requireSecret" is true
"permanentSecrets": [], // you can specify static secrets here that can be used by clients when "requireSecret" is true
"disablePreimageChecking": false // setting this to true will make it so poncho won't fetch and parse all bitcoin blocks looking for rogue preimages
}
```

The branding information won't be used unless contact URL and logo file are set. The logo should be a PNG file also placed under `$LIGHTNING_DIR/bitcoin/poncho/` and specified as a relative path.

Setting `disablePreimageChecking` to `true` will drastically decrease resource consumption since it won't fetch and parse all Bitcoin blocks. It is recommended if you are offering hosted channels only to trusted people or yourself. If you are a public entity offering channels to random people it is not recommended since it opens up the possibility of _reputational_ damage against you, see [this part of the spec about the preimage checking](https://github.com/fiatjaf/blips/blob/blip-hosted-channels/blip-0012.md#dealing-with-problems).

(Remember to remove the JSON comments in the file above otherwise it won't work.)

### Storage
Expand Down
4 changes: 3 additions & 1 deletion src/main/scala/ChannelMaster.scala
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ object ChannelMaster {
logger.info.item(block).msg("updated current block")

this.channels.values.foreach(_.onBlockUpdated(block))
this.preimageCatcher.onBlockUpdated(block)

if (!config.disablePreimageChecking)
this.preimageCatcher.onBlockUpdated(block)
}
}
case Failure(err) =>
Expand Down
3 changes: 2 additions & 1 deletion src/main/scala/Config.scala
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ case class Config(

// extra
requireSecret: Boolean = false,
permanentSecrets: List[String] = List.empty
permanentSecrets: List[String] = List.empty,
disablePreimageChecking: Boolean = false
) {
def init: InitHostedChannel = InitHostedChannel(
maxHtlcValueInFlightMsat = UInt64(maxHtlcValueInFlightMsat),
Expand Down

0 comments on commit 591b181

Please sign in to comment.