routing: update Sphinx API to include r-hash and per-hop-payload

This commit modifies both the Sphinx packet generation and processing
for recent updates to the API.

With the version 1 Sphinx specification, the payment hash is now
included in the MACs in order to thwart any potential replay attacks.
As a result, any attempts to replay previous HTLC packets MUST re-use
the same payment hash, meaning that the first-hop node can simply
settle the HTLC immediately, thwarting the attacker.

Additionally, within the Sphinx packet, each hop now gets a per-hop
payload which contains the necessary details (CTLV value, fee, etc) for
the node to successfully forward the payment. This per-hop payload is
protected by a packet-wide MAC.
This commit is contained in:
Olaoluwa Osuntokun
2016-10-27 20:40:08 -07:00
parent ac43de94f6
commit f37956e38e
5 changed files with 70 additions and 35 deletions

View File

@@ -57,6 +57,7 @@ type HTLCAddRequest struct {
// and the shared secret is fresh, then the node should stip off a layer
// of encryption, exposing the next hop to be used in the subsequent
// HTLCAddRequest message.
// TODO(roasbeef): can be fixed sized now that v1 Sphinx is "done".
OnionBlob []byte
}