Skip to content

Instantly share code, notes, and snippets.

View tomasvdw's full-sized avatar

Tomas van der Wansem tomasvdw

View GitHub Profile
@tomasvdw
tomasvdw / AddCursor.cpp
Created June 14, 2018 12:35
AddCursor.cpp
CUtxoCommit BuildUtxoCommit(CCoinsViewCursor* pcursor, size_t numworkers)
{
if (numworkers == 0)
throw std::invalid_argument("numworkers == 0");
std::atomic<int> count(0);
std::mutex cs;
@tomasvdw
tomasvdw / minersim.py
Created April 11, 2018 09:30
Selfish mining simulator
# Simulation of Selfish mining with gamma=0
# gamma=0 assumes a nearly full connected topology.
# We simulate a selfish pool p and h who mines honest
# As Gamma=0, we do not need to simulate more then two miners
# Tomas van der Wansem
import random;
struct MyData { pub x: usize }
fn process<F>(mut callback: F)
where F : FnMut(MyData) {
for n in 0..10 {
let data = MyData { x: n };
callback(data);