Skip to content
This repository was archived by the owner on Apr 22, 2025. It is now read-only.

Commit ee34177

Browse files
committed
FAB-7652 filterblock
PS: 06 Unrelated default enrollment profiles needs to be empty string. Change-Id: Id9242c40180292f0484d117c2d366cb73a4b23cc Signed-off-by: rickr <cr22rc@gmail.com>
1 parent 41ec4c3 commit ee34177

File tree

21 files changed

+599
-236
lines changed

21 files changed

+599
-236
lines changed

checkstyle-config.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,11 @@
105105

106106
<!-- Checks for Size Violations. -->
107107
<!-- See http://checkstyle.sf.net/config_sizes.html -->
108-
<module name="MethodLength"/>
108+
<module name="MethodLength">
109+
<property name="tokens" value="METHOD_DEF"/>
110+
<property name="max" value="200"/>
111+
<property name="countEmpty" value="false"/>
112+
</module>
109113
<module name="ParameterNumber">
110114
<property name="max" value="8"/>
111115
</module>

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
</scm>
3030
<properties>
3131
<grpc.version>1.8.0</grpc.version><!-- CURRENT_GRPC_VERSION -->
32-
<bouncycastle.version>1.58</bouncycastle.version>
32+
<bouncycastle.version>1.59</bouncycastle.version>
3333
<httpclient.version>4.5.4</httpclient.version>
3434
<skipITs>true</skipITs>
3535
<alpn-boot-version>8.1.7.v20160121</alpn-boot-version>
@@ -102,7 +102,7 @@
102102
<dependency>
103103
<groupId>com.google.protobuf</groupId>
104104
<artifactId>protobuf-java</artifactId>
105-
<version>3.5.0</version>
105+
<version>3.5.1</version>
106106
</dependency>
107107
<!-- https://mvnrepository.com/artifact/org.bouncycastle/bcpkix-jdk15on -->
108108
<dependency>

src/main/java/org/hyperledger/fabric/sdk/BlockEvent.java

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
import com.google.protobuf.InvalidProtocolBufferException;
2121
import org.hyperledger.fabric.protos.common.Common.Block;
22-
import org.hyperledger.fabric.protos.orderer.Ab;
22+
import org.hyperledger.fabric.protos.peer.PeerEvents;
2323
import org.hyperledger.fabric.protos.peer.PeerEvents.Event;
2424
import org.hyperledger.fabric.sdk.exception.InvalidProtocolBufferRuntimeException;
2525

@@ -29,7 +29,6 @@
2929
* @see Block
3030
*/
3131
public class BlockEvent extends BlockInfo {
32-
3332
// private static final Log logger = LogFactory.getLog(BlockEvent.class);
3433

3534
private final EventHub eventHub;
@@ -50,9 +49,8 @@ public class BlockEvent extends BlockInfo {
5049
this.event = event;
5150
}
5251

53-
BlockEvent(Peer peer, Ab.DeliverResponse resp) {
54-
super(resp.getBlock());
55-
52+
BlockEvent(Peer peer, PeerEvents.DeliverResponse resp) {
53+
super(resp);
5654
eventHub = null;
5755
this.peer = peer;
5856
this.event = null;
@@ -89,35 +87,26 @@ public Peer getPeer() {
8987
// }
9088

9189
boolean isBlockEvent() {
90+
if (peer != null) {
91+
return true; //peer always returns Block type events;
92+
}
9293

93-
return event == null || event.getEventCase() == Event.EventCase.BLOCK;
94+
return event != null && event.getEventCase() == PeerEvents.Event.EventCase.BLOCK;
9495
}
9596

9697
TransactionEvent getTransactionEvent(int index) throws InvalidProtocolBufferException {
9798

98-
return new TransactionEvent((TransactionEnvelopeInfo) getEnvelopeInfo(index), index);
99+
return isFiltered() ? new TransactionEvent(getEnvelopeInfo(index).filteredTx) :
100+
new TransactionEvent((TransactionEnvelopeInfo) getEnvelopeInfo(index));
99101
}
100102

101-
List<TransactionEvent> getTransactionEventsList() {
102-
103-
ArrayList<TransactionEvent> ret = new ArrayList<TransactionEvent>(getEnvelopeCount());
104-
for (TransactionEvent transactionEvent : getTransactionEvents()) {
105-
ret.add(transactionEvent);
103+
public class TransactionEvent extends TransactionEnvelopeInfo {
104+
TransactionEvent(TransactionEnvelopeInfo transactionEnvelopeInfo) {
105+
super(transactionEnvelopeInfo.getTransactionDeserializer());
106106
}
107107

108-
return ret;
109-
110-
}
111-
112-
public Iterable<TransactionEvent> getTransactionEvents() {
113-
114-
return new TransactionEventIterable();
115-
116-
}
117-
118-
public class TransactionEvent extends TransactionEnvelopeInfo {
119-
TransactionEvent(TransactionEnvelopeInfo transactionEnvelopeInfo, int index) {
120-
super(transactionEnvelopeInfo.getTransactionDeserializer(), index);
108+
TransactionEvent(PeerEvents.FilteredTransaction filteredTransaction) {
109+
super(filteredTransaction);
121110
}
122111

123112
/**
@@ -144,6 +133,23 @@ public Peer getPeer() {
144133
}
145134
}
146135

136+
List<TransactionEvent> getTransactionEventsList() {
137+
138+
ArrayList<TransactionEvent> ret = new ArrayList<TransactionEvent>(getEnvelopeCount());
139+
for (TransactionEvent transactionEvent : getTransactionEvents()) {
140+
ret.add(transactionEvent);
141+
}
142+
143+
return ret;
144+
145+
}
146+
147+
public Iterable<TransactionEvent> getTransactionEvents() {
148+
149+
return new TransactionEventIterable();
150+
151+
}
152+
147153
class TransactionEventIterator implements Iterator<TransactionEvent> {
148154
final int max;
149155
int ci = 0;

0 commit comments

Comments
 (0)