Skip to content

Commit 2e77f23

Browse files
committed
Temporary bug workaround.
1 parent e2d2e80 commit 2e77f23

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

anchor/anchor.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ func sendRawTransaction(msgtx *wire.MsgTx) (*wire.ShaHash, error) {
246246
if err := msgtx.BtcEncode(&buf, wire.ProtocolVersion); err != nil {
247247
// Hitting OOM by growing or writing to a bytes.Buffer already
248248
// panics, and all returned errors are unexpected.
249-
//panic(err)
249+
//panic(err)
250250
//TODO: should we have retry logic?
251251
return nil, err
252252
}
@@ -319,16 +319,21 @@ func createBtcdNotificationHandlers() btcrpcclient.NotificationHandlers {
319319
func InitAnchor(ldb database.Db) {
320320
anchorLog.Debug("InitAnchor")
321321
db = ldb
322-
dirBlockInfoMap, _ = db.FetchAllUnconfirmedDirBlockInfo()
322+
var err error
323+
dirBlockInfoMap, err = db.FetchAllUnconfirmedDirBlockInfo()
324+
if err != nil {
325+
anchorLog.Error("InitAnchor error - " + err.Error())
326+
return
327+
}
323328

324-
if err := initRPCClient(); err != nil {
329+
if err = initRPCClient(); err != nil {
325330
anchorLog.Error(err.Error())
326331
return
327332
}
328333
//defer shutdown(dclient)
329334
//defer shutdown(wclient)
330335

331-
if err := initWallet(); err != nil {
336+
if err = initWallet(); err != nil {
332337
anchorLog.Error(err.Error())
333338
return
334339
}

database/ldb/dblock.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,8 @@ func (db *LevelDb) FetchAllUnconfirmedDirBlockInfo() (dirBlockInfoMap map[string
435435
if iter.Value()[len(iter.Value())-1] == 0 {
436436
_, err := dBInfo.UnmarshalBinaryData(iter.Value())
437437
if err != nil {
438-
return nil, err
438+
//TODO: FIXME: return nil, err , rather than an incomplete map; fix the underlying problem
439+
return dirBlockInfoMap, err
439440
}
440441
dirBlockInfoMap[dBInfo.DBMerkleRoot.String()] = dBInfo
441442
}

0 commit comments

Comments
 (0)