Skip to content

Commit f0fdaa3

Browse files
authored
Merge pull request #5 from FactomProject/circle-ci
Re-merge circle-ci into master
2 parents 07cd595 + e24500a commit f0fdaa3

File tree

4 files changed

+69
-12
lines changed

4 files changed

+69
-12
lines changed

.circleci/config.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
version: 2
2+
jobs:
3+
build:
4+
docker:
5+
- image: circleci/golang:1.15
6+
7+
environment:
8+
TEST_RESULTS: /tmp/test-results
9+
10+
steps:
11+
- checkout
12+
- run: mkdir -p $TEST_RESULTS
13+
14+
- restore_cache:
15+
keys:
16+
- go-mod-v4-{{ checksum "go.sum" }}
17+
18+
- run: go build
19+
20+
- run:
21+
name: Run unit tests
22+
command: |
23+
PACKAGE_NAMES=$(go list ./... | circleci tests split --split-by=timings --timings-type=classname)
24+
gotestsum --junitfile ${TEST_RESULTS}/gotestsum-report.xml -- $PACKAGE_NAMES
25+
26+
- save_cache:
27+
key: go-mod-v4-{{ checksum "go.sum" }}
28+
paths:
29+
- "/go/pkg/mod"
30+
31+
- store_artifacts:
32+
path: /tmp/test-results
33+
destination: raw-test-output
34+
35+
- store_test_results:
36+
path: /tmp/test-results
37+
38+
gofmt:
39+
docker:
40+
- image: circleci/golang:1.15
41+
42+
steps:
43+
- checkout
44+
- run:
45+
name: "Enforce Go Formatted Code"
46+
command: test $(gofmt -l . | wc -l) -eq 0
47+
48+
govet:
49+
docker:
50+
- image: circleci/golang:1.15
51+
52+
steps:
53+
- checkout
54+
- run:
55+
name: "Go vet"
56+
command: go vet ./...
57+
58+
workflows:
59+
version: 2
60+
build-workflow:
61+
jobs:
62+
- build
63+
- gofmt
64+
- govet

walletDBO.go

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -250,15 +250,13 @@ func (e *DBSeed) NextIdentityKey() (*factom.IdentityKey, error) {
250250
func NewRandomSeed() (*DBSeed, error) {
251251
seed := make([]byte, 16)
252252
if n, err := rand.Read(seed); err != nil {
253-
panic(err)
254253
return nil, err
255254
} else if n != 16 {
256255
return nil, fmt.Errorf("Wrong number of bytes read: %d", n)
257256
}
258257

259258
mnemonic, err := bip39.NewMnemonic(seed)
260259
if err != nil {
261-
panic(err)
262260
return nil, err
263261
}
264262

@@ -274,7 +272,7 @@ func (db *WalletDatabaseOverlay) InsertDBSeed(seed *DBSeed) error {
274272
}
275273

276274
batch := []interfaces.Record{}
277-
batch = append(batch, interfaces.Record{seedDBKey, seedDBKey, seed})
275+
batch = append(batch, interfaces.Record{Bucket: seedDBKey, Key: seedDBKey, Data: seed})
278276

279277
return db.DBO.PutInBatch(batch)
280278
}
@@ -355,7 +353,7 @@ func (db *WalletDatabaseOverlay) InsertECAddress(e *factom.ECAddress) error {
355353
}
356354

357355
batch := []interfaces.Record{}
358-
batch = append(batch, interfaces.Record{ecDBPrefix, []byte(e.PubString()), e})
356+
batch = append(batch, interfaces.Record{Bucket: ecDBPrefix, Key: []byte(e.PubString()), Data: e})
359357

360358
return db.DBO.PutInBatch(batch)
361359
}
@@ -407,7 +405,7 @@ func (db *WalletDatabaseOverlay) InsertFCTAddress(e *factom.FactoidAddress) erro
407405
}
408406

409407
batch := []interfaces.Record{}
410-
batch = append(batch, interfaces.Record{fcDBPrefix, []byte(e.String()), e})
408+
batch = append(batch, interfaces.Record{Bucket: fcDBPrefix, Key: []byte(e.String()), Data: e})
411409

412410
return db.DBO.PutInBatch(batch)
413411
}
@@ -477,8 +475,6 @@ func (db *WalletDatabaseOverlay) RemoveAddress(pubString string) error {
477475
} else {
478476
return fmt.Errorf("Unknown address type")
479477
}
480-
481-
return nil
482478
}
483479

484480
type byFName []*factom.FactoidAddress
@@ -544,7 +540,7 @@ func (db *WalletDatabaseOverlay) InsertIdentityKey(e *factom.IdentityKey) error
544540
}
545541

546542
batch := []interfaces.Record{}
547-
batch = append(batch, interfaces.Record{identityDBPrefix, []byte(e.String()), e})
543+
batch = append(batch, interfaces.Record{Bucket: identityDBPrefix, Key: []byte(e.String()), Data: e})
548544

549545
return db.DBO.PutInBatch(batch)
550546
}
@@ -596,8 +592,6 @@ func (db *WalletDatabaseOverlay) RemoveIdentityKey(pubString string) error {
596592
} else {
597593
return err
598594
}
599-
600-
return nil
601595
}
602596

603597
type byKeyName []*factom.IdentityKey

wsapi/structs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ type identityKeyRequest struct {
8888
type importIdentityKeysRequest struct {
8989
Keys []struct {
9090
Secret string `json:"secret"`
91-
} `json:keys`
91+
} `json:"keys"`
9292
}
9393

9494
type activeIdentityKeysRequest struct {

wsapi/wsapi.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1571,7 +1571,6 @@ func factoidTxToTransaction(t interfaces.ITransaction) (
15711571

15721572
if r.TotalInputs <= r.TotalOutputs+r.TotalECOutputs {
15731573
r.FeesPaid = 0
1574-
r.FeesRequired = r.FeesRequired
15751574
} else {
15761575
r.FeesPaid = r.TotalInputs - (r.TotalOutputs + r.TotalECOutputs)
15771576
}

0 commit comments

Comments
 (0)