lightning network – Why does every HTLC in a commitment transaction require its own signature?

Why isn’t the signature for the entire commitment transaction enough?

Because the htlc_signature field contains the signature for the HTLC transactions spending from the htlc output(s) (either received or offered) of the commitment transaction.

To expand a bit, some paths of the HTLCs scripts (timeout for an offered htlc output and success for a received HTLC output) pays to a 2of2, thus you need the right transaction which spends from this output to be signed before comiting to this (otherwise unspendable by using this script path) output.

EDIT: This question originates from this Github issue, to which Olaoluwa Osuntokun (@Roasbeef) gave today a detailed high-level explanation of why second-stage HTLCs are used in Lightning Network.

The following is the copy paste of his answer that might be of interest to anyone passing by.

Here’s my attempt at a high level explanation:

We use something called two-stage HTLCs in the system. This allows us to decouple the CLTV (absolute timelock for HTLCs) from the CSV (commitment delay to allow for breach retribution). To see why this is an issue, consider if we had both of these in the top-level HTLC script. From here, one can imagine a scenario where we have an HTLC that can be timed out (absolute block height passed), but we can’t spend it (timing it out) until our CSV period has also expired. Therefore, one needs to set their CSV values taking into account the absolute timelock (CLTV) value as well. Critically, before a user can cancel their incoming off-chain HTLC (timing out the outgoing on-chain), they need to wait for this CSV period. However, if the CSV is greater than the time lock delta (diff between incoming and outgoing HTLCs), they’ve created a race and could possibly lose money.

Without HTLCs, the dependency between the CLTV delta value and the CSV value means that if one wants to have a higher CSV value (more time to punish malicious channel peers), then they also need to have a longer CLTV delta value. As an example, a common set up with lnd is that for super higher value channels we have a CSV value of 2016 blocks (two weeks). Without second-level HTLCs, we would need to also make our CTLV delta value (40 blocks default atm), greater than 2016 blocks. This change would then propagate through the entire network, resulting in very long time lock values. The sender of an HTLC eats the full time lock delay, meaning that know their absolute worst case is much higher, trading off for better multi-hop HTLC security.

Thankfully, we figured out a solution to this: two-stage HTLCs. Note that the HTLC scripts I described above were never actually deployed. Two-stage HTLCs are actually used in the original LN white paper for a similar reason. The defective design described above was created when developers were trying to compress down the scripts and on-chain footprint a bit.

A two-stage HTLC decouples the CSV period from one’s CTLV time-lock delta. To do this, we now require the party that forced closed to spend their HTLC with a special transaction. This transaction spends a CLTV clause in the script, and itself includes a nLocktime value as well. The output of this special transaction then pays to the party timing our or redeeming the HTLC, but then enforces a CSV period. We call them two stage as we enforce two states in the claim: wait for absolute timeout value, then wait for CSV value. Note that once the absolute timeout value passes, the party can spend the original HTLC output, transitioning the HTLC claim state machine to the CSV waiting period. At this point, they can safely cancel back any off-chain HTLCs, as the other party isn’t able to settle it with a pre-image at this point.

The way we enforce this spend, is that we make any HTLC spends from one’s commitment transaction (which you broadcast during a force close) actually be a multi-sig output. We use this output to create what’s essentially an “off-chain multi-sig covenant”. Since they require our signature to spend this output, we force them into a particular type of spend using pre-signed transactions. As a result, each time we want to give them a new commitment, in addition to the commitment signature (multi-sig spending teh funding output), we also send a series of signatures, one for each HTLC, that blesses their spend of the HTLC output.

My computer needs 435 watts of power and I have a 750w SMPS so will my SMPS take full 750w or just the 450w that I require?

My PC components need only upto 450w (435w exactly) and I have a 750w power supply…
So will my SMPS take full 750w of power from main electricity or just the 450w that are require?

keyboard shortcuts – does autohotkeys require flash or something? how do i run autohotkey script in chrome?

For this Timestamp: Pressing F5 notepad gives time 1st then date. How do I do date 1st then time?

i seem to not be able to use this script while in google chrome after uninstalling adobe flash (RIP) just now. however, i seem to be able to do this while in notepad. in this case, it’s not much different from pressing F5 in notepad.

does autohotkeys require flash or something? how do i run autohotkey script in chrome? what may hinder an autohotkey script from running in chrome?

dnd 5e – Does mounted combat require a willing rider as well as mount?

A party is traveling on a path through a woods when they are simultaneously attacked by a group of orcs and a single, overly-clever ogre. The ogre grabs the party’s fighter (successful grapple attack) and announces his intention to move 20 feet (speed halved) among the orcs, subjecting the fighter to multiple opportunity attacks as she leaves their reaches.

“Wait!” protests the fighter. “The opportunity attacks rule says…

You can make an opportunity Attack when a Hostile creature that you can see moves out of your reach…(but you) don’t provoke an opportunity Attack when you Teleport or when someone or something moves you without using your Movement, action, or Reaction.

“Since you are moving me, the orcs cannot attack me as you drag me past them.”

“Hmmm…” considers the ogre. Knowing full well that specific beats general, he tries to think of a case in which something can explicitly provoke opportunity attacks even if it is being moved. “Aha!” he says brightly. “The grapple rules say…

When you move, you can drag or carry the Grappled creature with you

The ogre easily flips the fighter across his shoulders. “Now I am carrying you.”

“That doesn’t matter.”

“If I am carrying you, I can be your mount. And the mounted combat rules say…”

if the mount provokes an opportunity attack while you’re on it, the attacker can target you
or the mount.

“That’s ridiculous,” says the fighter indignantly. “First of all, you can’t provoke an attack of opportunity from the orcs unless you and they are Hostile, and clearly you are allies.”

“You don’t know that,” says the ogre. “We are actually from different tribes, and it was a coincidence that we both ambushed your party at the same time. If we win, I expect we will fall to fighting one another over your loot.” The orcs nod in agreement. “Besides, the DMG definition of Hostile is…

A hostile creature opposes the adventurers and their goals but doesn’t necessarily attack them on sight.

“Setting aside the adventurer-centric language, as NPC’s these orcs and I oppose one another’s goals. As I move around, they could certainly choose to attack me rather than you.”

“Point taken – but you still can’t be my mount.”

“Why not? The Mounted Combat rules say…

A willing creature that is at least one size larger than you and that has an appropriate anatomy can serve as a mount, using the following rules…”

“I am a willing creature,” says the ogre, “I am at least one size larger than you, and, as you will note from your position atop my shoulders, I have appropriate anatomy. It is still my combat turn, and I say that I am your mount.”

“That’s not for you to decide! I mean, you can’t be my mount against my will! It says a creature can serve as a mount, and you are most definitely not serving me.”

“There’s no game definition of serve.”

“Right, so we go with the common English meaning of ‘being in service to’, ‘following commands’.”

“I rather prefer the English meaning of ‘able to be used as’; like after the orcs kill you, your helmet will serve as my chamber pot.”

The rules make it clear that to be a mount, the creature has to be willing. But does the rider have to be willing as well?

And if the rider does have to be willing, does that mean a rider that has been rendered unconscious no longer counts as a rider for the purposes of mounted combat? (an unconscious person on a moving horse could not receive opportunity attacks because they could no longer consent to be a rider?)

dnd 5e – Does casting a spell from an Ioun Stone/Ring of Spell Storing require components?

As quoted in the question, the magic items only utilize the slot level, save DC, attack bonus, and spellcasting ability of whomever cast into the item.

The magic items still make it:

as if you cast the spell.

This is not the magic item casting the spell via an action, but it is stating specifically as if you cast the spell and cites previously what IS brought over from the original casting (which is also very different than the general rule from the DMG on page 141).

In order to cast the spell out, whomever is doing it must provide any required components. For spells that include a costly component or a component that is used in the casting, it must be provided and used again.

These spells are not inherent to the magic item (and thus follow the general rules about magic item casting), but are specifically cast by another individual into the item to be recast by the user at another time (albeit with the aforementioned slot level, DC, attack, and spellcasting ability of the original caster.)

No components at all?

If no components are necessary at all, then there are neither verbal nor somatic components either, which seems at odds with as if you cast the spell.

The magic item is not being activated to cast via an action, you are still casting it.

author’s note: I no longer agree with my logic here, but keeping this up as an example of the counterargument to the accepted answer.

dnd 5e – Does the Dual Wielder feat require me to have the Two-Weapon Fighting fighting style as a prerequisite?

Since it adds damage modifiers, Two Weapon Fighting is not Obsolete.

Two Weapon Fighting allows you to add your damage modifier to your off hand/other/second weapon, though the fighting style is limited to light/finesse weapons. You are not required to have this fighting style as a pre-requisite for Dual Wielder (there are no prerequisites for that feat) but it is beneficial to use that fighting style.

Two-Weapon Fighting (Fighting Style, PHB, p. 72)
When you engage in two-weapon fighting, you can add your ability modifier to the damage of the second attack.

Two-Weapon Fighting (That anyone can use)(PHB, p. 195)
When you take the Attack action and attack with a light melee weapon that you’re holding in one hand, you can use a bonus action to attack with a different light melee weapon that you’re holding in the other hand. You don’t
add your ability modifier to the damage of the bonus attack, unless that modifier is negative.

Dual Wielder (feat, PHB, p. 165) offers different features:

  1. You gain a +1 bonus to AC while you are wielding a separate melee weapon in each hand.
  2. You can use two-weapon fighting even when the one handed melee weapons you are wielding aren’t light.
  3. You can draw or stow two one-handed weapons when you would normally be able to draw or stow only one.

From bottom to top, there are three cases of attacking with two weapons:

  1. You can use two light weapons, but the second one gets no damage
    bonus (anyone)
  2. You can use two light weapons, and the second one gets the damage
    bonus (Two Weapon Fighting, the fighting style)
  3. You can use any two weapons, get a +1 AC bonus, and can draw or
    stow both with the same action/interaction. Unless you also had the
    Two Weapon Fighting fighting style, this feat won’t add the damage
    modifier bonus to the second weapon.

The Two Weapon Fighting style makes your Dual Wielder a bit more effective since it adds the damage modifier to both attacks, not just the first one.

dnd 5e – Can an Unseen Servant do things that require ability checks?

Once on each of your turns as a bonus action, you can mentally
command the servant to move up to 15 feet and interact with an object.
The servant can perform simple tasks that a human servant could do,
such as fetching things, cleaning, mending, folding clothes, lighting
fires, serving food, and pouring wine. Once you give the command, the
servant performs the task to the best of its ability until it
completes the task, then waits for your next command.

(PHB p. 284)

What happens if the Unseen Servant e.g. tries to steal gold out of a pocket?
Or if he is commanded to pick a lock? I would consider those as “simple tasks that a human servant could do”.

Can an Unseen Servant do actions that require ability checks (apart from attacking, which is explicitely prohibited) and if yes, does the caster add his relevant modifier and proficiency bonus?

Does Find my device feature require internet connection?

I lost my phone in the house, and I was trying out this feature but couldn’t connect to my phone. Why? Does it require Internet connection? If so, this feature doesn’t make much sense…

composer – Require v8 only contrib module with v9 patch

  • Given I have Drupal 9 composer installation with composer-patches plugin
  • and given a contrib module with a stable v8 release, but no v9 release (not even dev branch)
  • and given that contrib module has a working v9 patch in the issue queue

is there any method to install that module + patch in composer? Even if I manually add both, the package and patch, to my composer.json, I still can’t require or update this module with composer due conflicting versions. I really want to avoid duplicating /contrib code into my project’s /custom codebase. My current workaround is:

  • forking that module to my own, private git repo
  • applying patch there
  • creating a new composer.json in my private git, and changing the package vendor to my custom_private_vendor
  • adding my private git as VCS repo in the D9 project’s composer.json
  • and then composer require custom_private_vendor/contrib_module

This fulfills my goal of not duplicating the contrib module in my projects custom codebase, but every time I do this I feel the urge to wash my dirty hands.

Is there something more elegant like composer require drupal/contrib_module --apply-patch-first or can I somehow target’s git with a specific patch included?

sql server 2016 – Does SQLLocalDB ever require an internet connection?

Does SQLLocalDB ever require an internet connection?

I have seem some very strange behavior on an end user PC. The computer is normally offline (and user wants it to be for security). They have small local databases and use SQLLocalDB to access them. Version is 13.1.4001.0

Normally everything works fine. User can connect to existing databases and create new ones. Every few weeks, SQLLocalDB hangs and timeout on creating a new database. Connecting the PC to the internet and then disconnecting it (and doing nothing else) fixes the issue for another few weeks.

I can’t find any mention in online documentation of this requirement. Is there a way to disable this connection requirement?

Background: We are using C# Framework 4.6.2 code to connect and use the database.

/// This line works
// 'Server' is Microsoft.SqlServer.Management.Smo.Server
var server = new Server("(localdb)myserverinstancename");

/// this line works 99% of the time, but sometimes timesout and throws 
///"Microsoft.SqlServer.Management.Common.ConnectionFailureException: Failed to connect to server"