Skip to content

Instantly share code, notes, and snippets.

View hieblmi's full-sized avatar
🏉
Play on

Slyghtning hieblmi

🏉
Play on
View GitHub Profile
BigInteger sqrt(BigInteger n) {
BigInteger a = BigInteger.ONE;
BigInteger b = n.shiftRight(5).add(BigInteger.valueOf(8));
while (b.compareTo(a) >= 0) {
BigInteger mid = a.add(b).shiftRight(1);
if (mid.multiply(mid).compareTo(n) > 0) {
b = mid.subtract(BigInteger.ONE);
} else {
a = mid.add(BigInteger.ONE);
}
#!/usr/bin/env python3
# Copyright (c) 2017-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""An example functional test
The module-level docstring should include a high-level description of
what the test is doing. It's the first thing people see when they open
the file and should give the reader information about *what* the test
is testing and *how* it's being tested

Keybase proof

I hereby claim:

  • I am hieblmi on github.
  • I am heebs (https://keybase.io/heebs) on keybase.
  • I have a public key ASD8737ORgEOecJUQRAZdWZpa3TbQaMnvN7meN1B0D8E3go

To claim this, I am signing this object:

@hieblmi
hieblmi / ptlc-notes.md
Last active October 18, 2023 16:42 — forked from instagibbs/ptlc-notes.md
PTLCs for LN

Messaging Changes

I am assuming minimal changes to commitment transaction structure, essentially swapping out HTLC for PTLC, so no fast-forward schemes here.

Here are output labels because I get confused so often what things in BOLTs mean:

  • (a) a_o_atx_* Alice-offered "offered PTLC" in Alice's tx
  • (b) a_o_btx_* Alice-offered "received PTLC" in Bob's tx
  • (c) b_o_atx_* Bob-offered "received PTLC" in Alice's tx
  • (d) b_o_btx_* Bob-offered "offered PTLC" in Bob's tx