specified header for rpc dial if access id is set

pull/567/head
kompotkot 2022-03-18 19:12:07 +00:00
rodzic d76098718b
commit 631555ab94
2 zmienionych plików z 16 dodań i 0 usunięć

Wyświetl plik

@ -143,8 +143,10 @@ func PollTxpoolContent(gethClient *rpc.Client, interval int, reporter *humbug.Hu
}
func InitTxPool() {
var accessID string
var blockchain string
var intervalSeconds int
flag.StringVar(&accessID, "access-id", "", "Access ID for Moonstream node balancer")
flag.StringVar(&blockchain, "blockchain", "", "Blockchain to crawl")
flag.IntVar(&intervalSeconds, "interval", 1, "Number of seconds to wait between RPC calls to query the transaction pool (default: 1)")
flag.Parse()
@ -180,6 +182,10 @@ func InitTxPool() {
if err != nil {
panic(fmt.Sprintf("Could not connect to geth: %s", err.Error()))
}
if accessID != "" {
gethClient.SetHeader("X-Node-Balancer-Access-Id", accessID)
gethClient.SetHeader("X-Node-Balancer-Data-Source", "blockchain")
}
defer gethClient.Close()
// Humbug client to be able write data in Bugout journal

Wyświetl plik

@ -0,0 +1,10 @@
#!/usr/bin/env sh
# Colpile application and run with provided arguments
set -e
PROGRAM_NAME="txpool"
go build -o "$PROGRAM_NAME" .
./"$PROGRAM_NAME" "$@"