Skip to content

Instantly share code, notes, and snippets.

@yyforyongyu
yyforyongyu / eve.log
Created December 5, 2022 17:40
trimmed log
// Eve received messages from Carol.
2022-12-06 01:09:31.414 [DBG] PEER: Peer([carol]): Received ChannelAnnouncement(chain_hash=0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206, short_chan_id=[SID: carol=>Bob]) from [carol]@127.0.0.1:55297
2022-12-06 01:09:31.449 [DBG] PEER: Peer([carol]): Received ChannelUpdate(chain_hash=0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206, short_chan_id=[SID: carol=>Bob], mflags=00000001, cflags=00000000, update_time=2022-12-06 01:09:22 +0800 CST) from [carol]@127.0.0.1:55297
2022-12-06 01:09:31.543 [DBG] DISC: Processing ChannelAnnouncement: peer=[carol]@127.0.0.1:55297, short_chan_id=[SID: carol=>Bob]
2022-12-06 01:09:31.767 [DBG] PEER: Peer([carol]): Received ChannelUpdate(chain_hash=0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206, short_chan_id=[SID: carol=>Bob], mflags=00000001, cflags=00000001, update_time=2022-12-06 01:09:21 +0800 CST) from [carol]@127.0.0.1:55297
// Eve tries to add the edge info heard from Carol.
2022-
@yyforyongyu
yyforyongyu / main.go
Last active March 3, 2025 09:56
A draft script to clean itest logs for lnd
package main
import (
"fmt"
"io/ioutil"
"os"
"sort"
"strings"
"time"
)
@yyforyongyu
yyforyongyu / main_test.go
Created January 18, 2023 21:49
Benchmark performance among sync map, mutex map and read-write mutex map.
package main
import (
"sync"
"sync/atomic"
"testing"
)
func BenchmarkReadMutexMap(b *testing.B) {
// Create a map with a mutex.
@yyforyongyu
yyforyongyu / main_test.go
Created January 19, 2023 10:57
Benchmark on read and write for `atomic.Bool` and mutex `bool`
func BenchmarkBoolAmoticWrite(b *testing.B) {
type foo struct {
x atomic.Bool
}
f := &foo{}
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
f.x.Store(true)
@yyforyongyu
yyforyongyu / channel_test.go
Last active October 7, 2024 09:43
Benchmark on `kvdb.Batch`
func TestBatchUpdate(t *testing.T) {
t.Parallel()
fullDB, err := MakeTestDB(t, OptionStoreFinalHtlcResolutions(true))
require.NoError(t, err, "unable to make test database")
cdb := fullDB.ChannelStateDB()
chanID := lnwire.ShortChannelID{
BlockHeight: 1,
@yyforyongyu
yyforyongyu / a.diff
Created January 27, 2025 02:50
Diff on event loop
diff --git a/htlcswitch/switch.go b/htlcswitch/switch.go
index 720625f2c..60a150e5d 100644
--- a/htlcswitch/switch.go
+++ b/htlcswitch/switch.go
@@ -280,6 +280,8 @@ type Switch struct {
// this channel.
linkIndex map[lnwire.ChannelID]ChannelLink
+ attemptResultReqChan chan *attemptResultReq
+