Skip to content

Instantly share code, notes, and snippets.

@gsalgado
gsalgado / go-tour-69.go
Created November 26, 2011 18:17
My solution to Go tour #70 - Web Crawler
package main
import (
"os"
"fmt"
)
type FetcherResult struct {
Urls []string
body string
@gsalgado
gsalgado / gist:817bb981d6729e6cd2df
Created July 21, 2014 17:47
Inproc socket doesn't seem to be released immediately after a socket.Close()
package atest
import (
"testing"
zmq "github.com/pebbe/zmq4"
)
func TestA(t *testing.T) {
socket, err := zmq.NewSocket(zmq.PUSH)
@gsalgado
gsalgado / gist:3f2c9bb931840351266d
Created July 21, 2014 18:56
zmq_close(socket) doesn't seem to release inproc endpoint immediately
#include <zmq.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <assert.h>
// The second bind will eventually fail with an 'Address already in use'
// unless we sleep long enough. I'd expect the zmq_close(sock) call to release
// the endpoint imeediately but that doesn't seem to be the case.

Keybase proof

I hereby claim:

  • I am gsalgado on github.
  • I am gsalgado (https://keybase.io/gsalgado) on keybase.
  • I have a public key whose fingerprint is 3C97 C4D0 D451 7279 5026 DE2F 61EB 0193 AABE B588

To claim this, I am signing this object:

diff --git a/waddrmgr/address.go b/waddrmgr/address.go
index c517355..e00e423 100644
--- a/waddrmgr/address.go
+++ b/waddrmgr/address.go
@@ -25,7 +25,6 @@ import (
"github.com/monetas/btcec"
"github.com/monetas/btcutil"
"github.com/monetas/btcutil/hdkeychain"
- "github.com/monetas/btcwallet/snacl"
)
diff --git a/waddrmgr/internal_test.go b/waddrmgr/internal_test.go
index 2868772..8a5bfe1 100644
--- a/waddrmgr/internal_test.go
+++ b/waddrmgr/internal_test.go
@@ -186,3 +189,10 @@ func TestDecryptExtendedKeyCannotCreateResultKey(t *testing.T) {
}
}
}
+
+func RunWithReplacedManagerCryptoKeyScript(vp *VotingPool, cryptoKey EncryptorDecryptor, fn func()) {
==> internal_test.go <==
package main
import "testing"
func TestInternalBit(t *testing.T) {
main_test.TstHelper()
}
type TxConfig struct {
selector coinset.CoinSelector
eligibleOutputs []txstore.Credit
}
func createTx(config TxConfig, outputs map[string]btcutil.Amount, changeAddr btcutil.Address) *MsgTx {
msgtx := btcwire.NewMsgTx()
addOutputs(msgtx, outputs)
// Calculate the total amount needed to fulfil all outputs.
import jsonschema
import json
l = [('../schema/seriesid-01.json', '../data/seriesid-01.json'), ...]
for schema_file, data_file in l:
schema = json.load(open(schema_file))
test_data = json.load(open(data_file))
// createTx selects inputs (from the given slice of eligible utxos)
// whose amount are sufficient to fulfil all the desired outputs plus
// the mining fee. It then creates and returns a CreatedTx containing
// the selected inputs and the given outputs, validating it (using
// validateMsgTx) as well.
func createTx(
eligible []txstore.Credit,
outputs map[string]btcutil.Amount,
bs *keystore.BlockStamp,
feeIncrement btcutil.Amount,