lightningnetwork / lightning-onion

Onion Routed Micropayments for the Lightning Network
MIT License
396 stars 125 forks source link

build: update to btcec/v2 and btcd/btcutil #55

Closed Roasbeef closed 2 years ago

Roasbeef commented 2 years ago

In this commit we update our deps to use the new btcec/v2 APIs as well as point to the new btcd/btcutil repo.

Along the way, we get a ~8% speed up in packet construction, and a ~9% speed up in packet processing due to the more optimized EC routines that btcec/v2 uses.

Benchmark run with the new changes:

goos: darwin
goarch: amd64
pkg: github.com/lightningnetwork/lightning-onion
cpu: VirtualApple @ 2.50GHz
BenchmarkPathPacketConstruction-8            366       3260221 ns/op      174541 B/op       1411 allocs/op
BenchmarkProcessPacket-8                    4926        247395 ns/op       21059 B/op         68 allocs/op
PASS

Benchmark run with the old code:

goos: darwin
goarch: amd64
pkg: github.com/lightningnetwork/lightning-onion
cpu: VirtualApple @ 2.50GHz
BenchmarkPathPacketConstruction-8            332       3522599 ns/op      170336 B/op       1410 allocs/op
BenchmarkProcessPacket-8                    4425        270806 ns/op       22166 B/op         99 allocs/op
PASS