Skip to content

Instantly share code, notes, and snippets.

View rustyrussell's full-sized avatar

Rusty Russell rustyrussell

View GitHub Profile
#! /bin/sh
test_run()
{
if [ "`./truncated-graph-traversal \"$1\"`" = "$2" ]; then
echo "$2"
else
./truncated-graph-traversal "$1" >&2
echo Expected "$2" >&2
exit 1

Keybase proof

I hereby claim:

  • I am rustyrussell on github.
  • I am rusty (https://keybase.io/rusty) on keybase.
  • I have a public key ASC4VX3VeiYZQYlueN8xKP66plAc-FBIXx8HWn8lCOAU7Ao

To claim this, I am signing this object:

@rustyrussell
rustyrussell / next-block-fees.sh
Last active November 24, 2016 04:11
What I'm watching right now... #bitcoin
# Assumes you've set blockmaxweight=4000000 and blocksizemax=1000000 in bitcoin.conf
# Every 10 seconds, prints out: <blocknum>:<satoshis-in-fees-nextblock>(<fees-in-USD)=<percent-of-subsidy>,
# eg:
# 440303:123401888($911.692)=9%
# 440304:62908635($464.768)=5%
# 440305:63134415($466.436)=5%
# 440305:63317722($467.791)=5%
i=0
diff --git a/08-transport.md b/08-transport.md
index d8edcf6..72fb64a 100644
--- a/08-transport.md
+++ b/08-transport.md
@@ -130,7 +130,7 @@ The following functions will also be referenced:
* The returned value is the raw big-endian byte serialization of
`x-coordinate` (using affine coordinates) of the generated point.
- * `HKDF`: a function is defined in [5](#reference-5), evaluated with a
+ * `HKDF(salt,ikm)`: a function is defined in [5](#reference-5), evaluated with a
@rustyrussell
rustyrussell / versionbitsbip.mediawiki
Last active February 4, 2017 07:11
Version bits BIP

  BIP: ??
  Title: Version bits with timeout and delay
  Author: Pieter Wuille <pieter.wuille@gmail.com>, Peter Todd <pete@petertodd.org>, Greg Maxwell <greg@xiph.org>, Rusty Russell <rusty@rustcorp.com.au>
  Status: Draft
  Type: Informational Track
  Created: 2015-10-04

Abstract

@rustyrussell
rustyrussell / ping-revision.diff
Created March 31, 2017 03:15
Suggested update for PR#134
commit 108869b8cdfa33c4ae4b842e990047b6b1e805a2
Author: Rusty Russell <rusty@rustcorp.com.au>
Date: Fri Mar 31 13:21:35 2017 +1030
UPDATES:
1. rename randombytes to ignored, and say they SHOULD BE zero. Simpler.
2. Add explicit padding field to `ping`: that keeps it extensible.
3. Split requirements into sender and receiver; they're kind of intertwined
so let's combine the two sections.
#define STRUCTEQ_SAFE(t, ...) \
static inline bool structeq_##t(const struct t *a, const struct t *b) \
{ \
return CPPMAGIC_JOIN(&&, STRUCTEQ_MAP2(STRUCTEQ_MEMBEREQ_, t, __VA_ARGS__)); \
}
#define STRUCTEQ_MEMBEREQ_(t, m) \
(memcmp(&a->m, &b->m, sizeof(a->m)) == 0)
/* Stolen from cppmagic, but with a extra arg added. */
@rustyrussell
rustyrussell / siphash-route-bench.patch
Created February 23, 2018 00:47
Unfinished patch for switching from isaac to siphash...
diff --git a/gossipd/routing.c b/gossipd/routing.c
index 69db3001..5798c239 100644
--- a/gossipd/routing.c
+++ b/gossipd/routing.c
@@ -5,7 +5,6 @@
#include <ccan/array_size/array_size.h>
#include <ccan/crypto/siphash24/siphash24.h>
#include <ccan/endian/endian.h>
-#include <ccan/isaac/isaac64.h>
#include <ccan/structeq/structeq.h>
@rustyrussell
rustyrussell / Bbock.hex
Created July 4, 2018 05:02
bitcoin-cli getblock 0000000000000000000fda35b2a2a3e24009d64f043c9f0370825a7193667232 false
This file has been truncated, but you can view the full file.
00000020d63872b76e1b69d756ee0856fe74fde833cf4968d04b3900000000000000000076cb2f126a6680329324844a0356af99111c3e8ce45fdad71c83850abd0537074d9e0a5b495a41178938eee4fd7f04010000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff4503670108fabe6d6dcf3f8fa3f9f67db57c09b2a87b6116f3ec977211a39ce649f14c626e6e6274960100000000000000036507014d0fa1885d01008e300a2f736c7573682f0000000003e2552e4b000000001976a9147c154ed1dc59609e3d26abb2df2ea3d587cd8c4188ac00000000000000002c6a4c2952534b424c4f434b3a54129dce723400505ab51333431c504b3272a6203613c88a057150e0628e135d0000000000000000266a24aa21a9edfd0c8d457a5e85d6fe394a02074c0812467784561d5d117382ddddc814b2644c01200000000000000000000000000000000000000000000000000000000000000000000000000100000002e370c865451403fe21b4403ebf3e886d5a1d7d1cdd2ac19c3155b8a1f132d0a3010000006a4730440220256abe80fb0b613d4c1f6a555a697abd9b14194709888e0d46e9b8f3e1db49b10220057c7a58deee04c0581f3b5ae1434b675ca5d060934fffb68ae7b825f4820556012102ded4ea17bea78f9ae064ddadf7e33bc05e0f65f0667ac1
@rustyrussell
rustyrussell / build-release.sh
Created October 26, 2018 00:42
Release script for c-lightning
#! /bin/sh
set -e
if [ "$(git status --porcelain -u no)" != "" ]; then
echo "Not a clean git directory" >&2
exit 1
fi
VERSION=`git tag --points-at HEAD`
if [ "$VERSION" = "" ]; then