Skip to content

Instantly share code, notes, and snippets.

Avatar

Amiti Uttarwar amitiuttarwar

View GitHub Profile
@amitiuttarwar
amitiuttarwar / templates.md
Last active Jun 20, 2020
templates in C++
View templates.md

High Level

  • point of template is to accept type as parameter
  • function templates: a declaration that can generate declarations for other functions
  • class templates: generalization of object type

Syntax

function template generic example:

template <typename T>
T max(T a, T b)
@amitiuttarwar
amitiuttarwar / rebroadcast filters
Last active Jan 2, 2020
How the filters interact to reduce the rebroadcast set.
View rebroadcast filters
Reducing noise in the rebroadcast set:
I think there are two ways these filters reduce the rebroadcast set
1. Caching min fee rate by itself —> mempool is emptying out, blocks are being mined & txn fees are decreasing. Time to rebroadcast, set is calculated & cache is applied.
Time 1: caching job runs, top block computed to include a, b, c
Mempool looks like: j i h g f e d | c b a
Time 2-4: txns come in
@amitiuttarwar
amitiuttarwar / backup_dotfiles.md
Created Nov 25, 2019
Managing dotfiles with work-trees.
View backup_dotfiles.md

Idea: make $HOME the git work-tree, with a bare repo in a dummy folder (.dotfiles). The git commands use .dotfiles as the git directory, and $HOME as the work directory.

Setup

  1. create "bare" repository
  • don't contain working tree aka copy of source files
  • store git revision history in root folder of repo instead of .git subfolder
mkdir $HOME/.dotfiles 
git init --bare $HOME/.dotfiles
View transaction_rebroadcasting.md

Background: Currently, a node will only rebroadcast a transaction if it is the originating wallet. This is awful for privacy.

PR #16698 reworks the rebroadcast logic to significantly improve privacy.

Overview of changes

  • Instead of the wallet directly relaying transactions to peers, the wallet will submit unconfirmed txns to the node, and the node will apply logic to trigger txn rebroadcasts.
  • The node will apply rebroadcast conditions to all transactions.
  • The wallet will attempt to resubmit unconfirmed transactions to the node on a scheduled timer. This is only useful if the txn is dropped from the local mempool before it gets mined.
  • The mempool tracks locally submitted transactions (wallet & rpc) to ensure they are succesfully rebroadcast. Success is defined as receiving a GETDATA for the txn.
View transaction rebroadcasting
I propose reworking the rebroadcast logic to
1. Significantly improve privacy
2. Create a cleaner divide between wallet & node responsibilities
#### Conceptual changes
* Instead of the wallet directly relaying transactions to peers , the wallet will submit unconfirmed txns to the node, and the node will apply logic to trigger txn rebroadcasts.
* The node will not keep track of “my” transactions but instead apply rebroadcast conditions to _all_ transactions.
* The wallet will attempt to resubmit unconfirmed transactions to the node on a scheduled timer. This is to ensure the txn is not dropped from the local mempool.
New rebroadcast conditions:
* relies on `BlockAssembler::addPackageTxs` to identify top block of transactions based on current mempool. I’ll call this “top transactions”.
You can’t perform that action at this time.