Skip to content

Instantly share code, notes, and snippets.

diff --git a/rlp/codec.py b/rlp/codec.py
index d743bb8..34dc2b3 100644
--- a/rlp/codec.py
+++ b/rlp/codec.py
@@ -12,7 +12,7 @@ from rlp.atomic import (
from rlp.exceptions import EncodingError, DecodingError
from rlp.sedes.binary import Binary as BinaryClass
from rlp.sedes import big_endian_int, binary, boolean, text
-from rlp.sedes.lists import List, is_sedes
+from rlp.sedes.lists import List, is_sedes, is_sequence
diff --git a/p2p/lightchain.py b/p2p/lightchain.py
index 8a7774c8..81f133b9 100644
--- a/p2p/lightchain.py
+++ b/p2p/lightchain.py
@@ -248,6 +248,7 @@ class LightPeerChain(PeerPoolSubscriber, BaseService):
:return: the block number of the new tip after importing the header
"""
new_tip = None
+ self.profiler.enable()
for header in headers:
diff --git a/p2p/server.py b/p2p/server.py
index 1ae34acf..1b490b43 100644
--- a/p2p/server.py
+++ b/p2p/server.py
@@ -7,6 +7,7 @@ from typing import (
Type,
)
+import netifaces
import upnpclient
@gsalgado
gsalgado / quorum-new-block.md
Last active October 16, 2017 07:34
How a block gets added to the chain in quorum

How a block gets added to the chain in quorum

This lives in the quorum repo now

@gsalgado
gsalgado / native-go-dapps.md
Created January 27, 2017 16:40
Native DApps: Go bindings to Ethereum contracts

[Please note, events are not yet implemented as they need some RPC subscription features that are still under review. They will hopefully get pushed out in a few days.]

The original roadmap and/or dream of the Ethereum platform was to provide a solid, high performing client implementation of the consensus protocol in various languages, which would provide an RPC interface for JavaScript DApps to communicate with, pushing towards the direction of the Mist browser, through which users can interact with the blockchain.

Although this was a solid plan for mainstream adoption and does cover quite a lot of use cases that people come up with (mostly where people manually interact with the blockchain),

@gsalgado
gsalgado / go-ethereum-code-walkthrough.md
Last active June 20, 2022 11:42
Code Walkthrough for new block in go-ethereum

Following a block from the network socket to the hard drive

Note: All links to the code are based on a fixed revision, so we can link line numbers. Code might have changed by now, nonetheless use these revisions when doing updates to this document.

Preconditons

  • the app was configured and started
  • all services registered
  • the discovery protocol discovered some nodes
  • the peermanager successfully connected a node
  • established an encrypted multiplexed session
@gsalgado
gsalgado / statsdbug.go
Created January 15, 2016 14:50
statsd-bug
package main
import (
"fmt"
"github.com/quipo/statsd"
)
func main() {
statsdC := statsd.NewStatsdClient("localhost:8999", "foo.")
// addFirstElement picks the first item from eligible and calls addInput
// to add it to the given transaction.
func addFirstElement(eligible []txstore.Credit, tx *btcwire.MsgTx, addInput func(*btcwire.MsgTx, txstore.Credit) error) (*txstore.Credit, error) {
input := eligible[0]
if err := addInput(tx, input); err != nil {
return nil, err
}
return &input, nil
}
func createTx(
eligible []txstore.Credit,
outputs map[string]btcutil.Amount,
bs *keystore.BlockStamp,
feeIncrement btcutil.Amount,
changeAddress func(*keystore.BlockStamp) (btcutil.Address, error),
addInput func(*btcwire.MsgTx, txstore.Credit) error) (*CreatedTx, error) {
var err error
msgtx := btcwire.NewMsgTx()
// 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,