Catch and log panic in blockbook main

pull/197/head
Martin Boehm 2019-06-11 16:27:47 +02:00
parent c4487ac94b
commit d5f11561ac
3 changed files with 10 additions and 2 deletions

View File

@ -347,7 +347,7 @@ func TestUnpackTx(t *testing.T) {
func TestDeriveAddressDescriptorsFromTo(t *testing.T) {
parser := NewNulsParser(GetChainParams("main"), &btc.Configuration{})
// test xpub xprv math ,and get private key
xprv := "xprv9yEvwSfPanK5gLYVnYvNyF2CEWJx1RsktQtKDeT6jnCnqASBiPCvFYHFSApXv39bZbF6hRaha1kWQBVhN1xjo7NHuhAn5uUfzy79TBuGiHh"
xpub := "xpub6CEHLxCHR9sNtpcxtaTPLNxvnY9SQtbcFdov22riJ7jmhxmLFvXAoLbjHSzwXwNNuxC1jUP6tsHzFV9rhW9YKELfmR9pJaKFaM8C3zMPgjw"

View File

@ -31,7 +31,7 @@ func NewRitocoinRPC(config json.RawMessage, pushHandler func(bchain.Notification
// Initialize initializes RitocoinRPC instance.
func (b *RitocoinRPC) Initialize() error {
ci, err := b.GetChainInfo()
ci, err := b.GetChainInfo()
if err != nil {
return err
}

View File

@ -15,6 +15,7 @@ import (
_ "net/http/pprof"
"os"
"os/signal"
"runtime/debug"
"strings"
"sync/atomic"
"syscall"
@ -105,6 +106,13 @@ func init() {
}
func main() {
defer func() {
if e := recover(); e != nil {
glog.Error("main recovered from panic: ", e)
debug.PrintStack()
os.Exit(-1)
}
}()
os.Exit(mainWithExitCode())
}