Skip to content

Commit 25ab661

Browse files
authored
network service cleanup (#601)
Signed-off-by: Angelo De Caro <[email protected]>
1 parent c4c331a commit 25ab661

File tree

7 files changed

+9
-60
lines changed

7 files changed

+9
-60
lines changed

integration/token/fungible/views/checks.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,6 @@ func (m *CheckTTXDBView) Call(context view.Context) (interface{}, error) {
9797
switch {
9898
case vc == network.Unknown:
9999
errorMessages = append(errorMessages, fmt.Sprintf("transaction record [%s] is unknown for vault but not for the db [%s]", transactionRecord.TxID, driver.TxStatusMessage[transactionRecord.Status]))
100-
case vc == network.HasDependencies:
101-
errorMessages = append(errorMessages, fmt.Sprintf("transaction record [%s] has dependencies", transactionRecord.TxID))
102100
case vc == network.Valid && transactionRecord.Status == ttxdb.Pending:
103101
errorMessages = append(errorMessages, fmt.Sprintf("transaction record [%s] is valid for vault but pending for the db", transactionRecord.TxID))
104102
case vc == network.Valid && transactionRecord.Status == ttxdb.Deleted:

token/services/network/driver/network.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,6 @@ type Network interface {
5555
// Broadcast sends the passed blob to the network
5656
Broadcast(context context.Context, blob interface{}) error
5757

58-
// IsFinalForParties takes in input a transaction id and an array of identities.
59-
// The identities are contacted to gather information about the finality of the
60-
// passed transaction
61-
IsFinalForParties(id string, endpoints ...view.Identity) error
62-
63-
// IsFinal takes in input a transaction id and waits for its confirmation
64-
// with the respect to the passed context that can be used to set a deadline
65-
// for the waiting time.
66-
IsFinal(ctx context.Context, id string) error
67-
6858
// NewEnvelope returns a new instance of an envelope
6959
NewEnvelope() Envelope
7060

token/services/network/fabric/network.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -200,14 +200,6 @@ func (n *Network) Broadcast(context context.Context, blob interface{}) error {
200200
return n.n.Ordering().Broadcast(context, blob)
201201
}
202202

203-
func (n *Network) IsFinalForParties(id string, endpoints ...view.Identity) error {
204-
return n.ch.Finality().IsFinalForParties(id, endpoints...)
205-
}
206-
207-
func (n *Network) IsFinal(ctx context.Context, id string) error {
208-
return n.ch.Finality().IsFinal(ctx, id)
209-
}
210-
211203
func (n *Network) NewEnvelope() driver.Envelope {
212204
return n.n.TransactionManager().NewEnvelope()
213205
}

token/services/network/logger.go

Lines changed: 0 additions & 11 deletions
This file was deleted.

token/services/network/network.go

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"time"
1616

1717
view2 "github.com/hyperledger-labs/fabric-smart-client/platform/view"
18+
"github.com/hyperledger-labs/fabric-smart-client/platform/view/services/flogging"
1819
"github.com/hyperledger-labs/fabric-smart-client/platform/view/view"
1920
"github.com/hyperledger-labs/fabric-token-sdk/token"
2021
api2 "github.com/hyperledger-labs/fabric-token-sdk/token/driver"
@@ -23,17 +24,17 @@ import (
2324
"github.com/pkg/errors"
2425
)
2526

26-
type ValidationCode int
27+
type ValidationCode = driver.ValidationCode
2728

2829
const (
29-
_ ValidationCode = iota
30-
Valid // Transaction is valid and committed
31-
Invalid // Transaction is invalid and has been discarded
32-
Busy // Transaction does not yet have a validity state
33-
Unknown // Transaction is unknown
34-
HasDependencies // Transaction is unknown but has known dependencies
30+
Valid = driver.Valid // Transaction is valid and committed
31+
Invalid = driver.Invalid // Transaction is invalid and has been discarded
32+
Busy = driver.Busy // Transaction does not yet have a validity state
33+
Unknown = driver.Unknown // Transaction is unknown
3534
)
3635

36+
var logger = flogging.MustGetLogger("token-sdk.network")
37+
3738
type UnspentTokensIterator = driver.UnspentTokensIterator
3839

3940
// TxStatusChangeListener is the interface that must be implemented to receive transaction status change notifications
@@ -324,19 +325,6 @@ func (n *Network) Broadcast(context context.Context, blob interface{}) error {
324325
}
325326
}
326327

327-
// IsFinalForParties returns true if the given transaction is final for the given parties
328-
func (n *Network) IsFinalForParties(id string, endpoints ...view.Identity) error {
329-
return n.n.IsFinalForParties(id, endpoints...)
330-
}
331-
332-
// IsFinal returns true if the given transaction is final
333-
func (n *Network) IsFinal(ctx context.Context, id string) error {
334-
if ctx == nil {
335-
ctx = context.Background()
336-
}
337-
return n.n.IsFinal(ctx, id)
338-
}
339-
340328
// AnonymousIdentity returns a fresh anonymous identity
341329
func (n *Network) AnonymousIdentity() view.Identity {
342330
return n.n.LocalMembership().AnonymousIdentity()

token/services/network/orion/network.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,6 @@ func (n *Network) Broadcast(_ context.Context, blob interface{}) error {
131131
return err
132132
}
133133

134-
func (n *Network) IsFinalForParties(id string, endpoints ...view.Identity) error {
135-
panic("implement me")
136-
}
137-
138-
func (n *Network) IsFinal(ctx context.Context, id string) error {
139-
return n.n.Finality().IsFinal(ctx, id)
140-
}
141-
142134
func (n *Network) NewEnvelope() driver.Envelope {
143135
return n.n.TransactionManager().NewEnvelope()
144136
}

token/services/vault/driver/driver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ SPDX-License-Identifier: Apache-2.0
66

77
package driver
88

9-
type ValidationCode int
9+
type ValidationCode = int
1010

1111
const (
1212
_ ValidationCode = iota

0 commit comments

Comments
 (0)