Skip to content

Instantly share code, notes, and snippets.

@nymkappa
Created July 24, 2022 15:23
Show Gist options
  • Save nymkappa/0e6111cc1f0b254a510e2f89ed48ba61 to your computer and use it in GitHub Desktop.
Save nymkappa/0e6111cc1f0b254a510e2f89ed48ba61 to your computer and use it in GitHub Desktop.
Generate LN history
START=$1
END=$2
END_TIMESTAMP=$(gdate -u +%s -d "$END")
echo "Generating LN topologies between" "$START" to "$END"
DAYS=0
CURRENT_TIMESTAMP=0
while [ "$CURRENT_TIMESTAMP" -lt "$END_TIMESTAMP" ]
do
CURRENT_TIMESTAMP=$(gdate -u +%s -d "$START+$DAYS days")
echo "===================="
echo "Generating topology for" $(gdate -u -d @"$CURRENT_TIMESTAMP")
lntopo-cli timemachine restore --fmt=graphml ~/Downloads/gossip-20210908.gsp "$CURRENT_TIMESTAMP" > topology_"$CURRENT_TIMESTAMP"
echo "Found" $(grep "<node" topology_"$CURRENT_TIMESTAMP" | wc -l) "nodes"
echo "Found" $(grep "<edge" topology_"$CURRENT_TIMESTAMP" | wc -l) "channels"
((DAYS=DAYS+1))
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment