Git Product home page Git Product logo

go-electrum's People

Contributors

d4l3k avatar elbandi avatar qshuai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

go-electrum's Issues

在生产上能稳定运行吗

你好,请问这个版本在生产上能稳定运行吗?

在readme中这段示例代码直接painc了, 而且看到有依赖于这个地址 electrum.dragonzone.net:50001,如果这里不提供服务了怎么办?

package main

import (
  "log"

  "github.com/qshuai/go-electrum/electrum"
)

func main() {
	node := electrum.NewNode()
	if err := node.ConnectTCP("electrum.dragonzone.net:50001"); err != nil {
		log.Fatal(err)
	}
	balance, err := node.BlockchainAddressGetBalance("1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L")
	if err != nil {
		log.Fatal(err)
	}
	log.Printf("Address balance: %+v", balance)
}
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x11284ee]

goroutine 1 [running]:
github.com/qshuai/go-electrum/electrum.(*Node).BlockchainAddressGetBalance(0xc420102000, 0x118821c, 0x22, 0x0, 0x0, 0xc4200107b0)
	~/5-goland/src/github.com/qshuai/go-electrum/electrum/blockchain.go:87 +0x11e
main.main()
	~/5-goland/src/thewaytogo/electrumClient.go:14 +0x181

Process finished with exit code 2

connect ConnectTCP

how to connect ConnectTCP correctly, if one server disconnects to connect to another and so on
round

    node := NewNode()
    if err := node.ConnectTCP("electrum.anduck.net:50011"); err != nil {}
if err := node.ConnectTCP("ndnd.selfhost.eu:50001"); err != nil {}
if err := node.ConnectTCP("ip119.ip-54-37-91.eu:50001"); err != nil {}

Usage of atomic is not atomic

	msg := request{
		Id:     atomic.LoadUint64(&n.nextId),
		Method: method,
		Params: params,
	}
	atomic.AddUint64(&n.nextId, 1)

is not the proper way to use the atomic package. You cannot guarantee that another goroutine will not read n.nextId between the time the code reads and then updates the value.

The correct pattern looks like:

msg := request{
  Id: atomic.AddUint64(&nextId, 1)
  ...
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.