Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: nbd-wtf/trustedcoin
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: ce2896f81ede5a2eb65ca5c00f694a1059b7d9b8
Choose a base ref
..
head repository: nbd-wtf/trustedcoin
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: c5009ede50dcefdc0e614709819190b810cb69f4
Choose a head ref
Showing with 10 additions and 7 deletions.
  1. +10 −7 main.go
17 changes: 10 additions & 7 deletions main.go
Original file line number Diff line number Diff line change
@@ -57,8 +57,6 @@ func main() {
{Name: "bitcoin-rpcport", Type: "string", Description: "Port to bitcoind RPC (optional).", Default: ""},
{Name: "bitcoin-rpcuser", Type: "string", Description: "Username to bitcoind RPC (optional).", Default: ""},
{Name: "bitcoin-rpcpassword", Type: "string", Description: "Password to bitcoind RPC (optional).", Default: ""},
{Name: "proxy", Type: "string", Description: "Socks proxy (optional)", Default: ""},
{Name: "always-use-proxy", Type: "string", Description: "Always use the proxy when connecting to esploras. (optional)", Default: "true"},
},
RPCMethods: []plugin.RPCMethod{
{
@@ -67,6 +65,7 @@ func main() {
"Get the bitcoin block at a given height",
"",
func(p *plugin.Plugin, params plugin.Params) (resp interface{}, errCode int, err error) {

height := params.Get("height").Int()

blockUnavailable := map[string]interface{}{
@@ -175,11 +174,15 @@ func main() {
OnInit: func(p *plugin.Plugin) {
network = p.Network

proxy := p.Args.Get("proxy").String()
always_use_proxy := p.Args.Get("always-use-proxy").String()
if proxy != "" && always_use_proxy == "true" {
os.Setenv("HTTP_PROXY", "socks5://" + proxy)
os.Setenv("HTTPS_PROXY", "socks5://" + proxy)
proxy := p.Configuration.Get("proxy")
always_use_proxy := p.Configuration.Get("always_use_proxy").Bool()

if proxy.Exists() && always_use_proxy {
socks_proxy := "socks5://" + proxy.Get("address").String() + ":" + proxy.Get("port").String()
p.Logf("using proxy: %s", socks_proxy)

os.Setenv("HTTP_PROXY", socks_proxy)
os.Setenv("HTTPS_PROXY", socks_proxy)
}

// we will try to use a local bitcoind