Skip to content

Instantly share code, notes, and snippets.

@barkthins
barkthins / geth.patch
Created Mar 10, 2016
A patch for geth that will cause it to mine every second. This is useful for accelerating unit test of solidity contracts. I will attempt to keep this patch up to date, no guarantees.
View geth.patch
diff --git a/eth/fetcher/fetcher.go b/eth/fetcher/fetcher.go
index d88d919..f03fd30 100644
--- a/eth/fetcher/fetcher.go
+++ b/eth/fetcher/fetcher.go
@@ -34,7 +34,7 @@ import (
const (
arriveTimeout = 500 * time.Millisecond // Time allowance before an announced block is explicitlrd
gatherSlack = 100 * time.Millisecond // Interval used to collate almost-expired announces witfs
- fetchTimeout = 5 * time.Second // Maximum alloted time to return an explicitly requestebk
+ fetchTimeout = 1 * time.Second // Maximum alloted time to return an explicitly requestebk
View send.js
#!/usr/bin/env node
var Promise = require('bluebird');
var fs = require('fs');
var test = require('blue-tape');
require('../web3E.js');
var Web3 = require('web3');
var web3 = new Web3();
var solc = require('solc');
View httpprovider.js
diff --git a/node_modules/web3/lib/web3/httpprovider.js b/node_modules/web3/lib/web3/httpprovider.js
index aafa5b6..f2770c6 100644
--- a/node_modules/web3/lib/web3/httpprovider.js
+++ b/node_modules/web3/lib/web3/httpprovider.js
@@ -76,6 +76,7 @@ HttpProvider.prototype.send = function (payload) {
try {
request.send(JSON.stringify(payload));
} catch(error) {
+ console.error(error);
throw errors.InvalidConnection(this.host);
View compiler.js
#!/usr/bin/env node
var solc = require('solc');
var fs = require('fs');
var source = fs.readFileSync("test/constructor.sol", 'utf8');
console.log(solc.version());
var output = solc.compile(source,1);
console.log(output);