Remove All Batch DB Calls (#4775)

* remove all batch calls
This commit is contained in:
Nishant Das
2020-02-06 16:23:06 +08:00
committed by GitHub
parent bfa103317e
commit b99ae2cbe4
2 changed files with 3 additions and 3 deletions

View File

@@ -95,7 +95,7 @@ func (k *Store) HasAttestation(ctx context.Context, attDataRoot [32]byte) bool {
func (k *Store) DeleteAttestation(ctx context.Context, attDataRoot [32]byte) error {
ctx, span := trace.StartSpan(ctx, "BeaconDB.DeleteAttestation")
defer span.End()
return k.db.Batch(func(tx *bolt.Tx) error {
return k.db.Update(func(tx *bolt.Tx) error {
bkt := tx.Bucket(attestationsBucket)
enc := bkt.Get(attDataRoot[:])
if enc == nil {
@@ -151,7 +151,7 @@ func (k *Store) SaveAttestation(ctx context.Context, att *ethpb.Attestation) err
return err
}
err := k.db.Batch(func(tx *bolt.Tx) error {
err := k.db.Update(func(tx *bolt.Tx) error {
attDataRoot, err := ssz.HashTreeRoot(att.Data)
if err != nil {
return err

View File

@@ -206,7 +206,7 @@ func (k *Store) HasBlock(ctx context.Context, blockRoot [32]byte) bool {
func (k *Store) DeleteBlock(ctx context.Context, blockRoot [32]byte) error {
ctx, span := trace.StartSpan(ctx, "BeaconDB.DeleteBlock")
defer span.End()
return k.db.Batch(func(tx *bolt.Tx) error {
return k.db.Update(func(tx *bolt.Tx) error {
bkt := tx.Bucket(blocksBucket)
enc := bkt.Get(blockRoot[:])
if enc == nil {