now return first resolver as upstream-id in case of quorum rpc read.
This commit is contained in:
@@ -119,7 +119,7 @@ class QuorumRpcReader(
|
||||
.filter { it.isResolved() } // return nothing if not resolved
|
||||
.map { quorum ->
|
||||
// TODO find actual quorum number
|
||||
Result(quorum.getResult()!!, quorum.getSignature(), 1, quorum.getResolvedBy().map { it.nodeId() })
|
||||
Result(quorum.getResult()!!, quorum.getSignature(), 1, quorum.getResolvedBy())
|
||||
}
|
||||
.switchIfEmpty(defaultResult)
|
||||
}
|
||||
@@ -198,6 +198,6 @@ class QuorumRpcReader(
|
||||
val value: ByteArray,
|
||||
val signature: ResponseSigner.Signature?,
|
||||
val quorum: Int,
|
||||
val resolvers: Collection<Byte>
|
||||
val resolvers: Collection<Upstream>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -311,7 +311,7 @@ open class NativeCall(
|
||||
.map {
|
||||
val bytes = ctx.resultDecorator.processResult(it)
|
||||
validateResult(bytes, "remote", ctx)
|
||||
CallResult.ok(ctx.id, ctx.nonce, bytes, it.signature, ctx.upstream.getId(), ctx)
|
||||
CallResult.ok(ctx.id, ctx.nonce, bytes, it.signature, it.resolvers.first().getId(), ctx)
|
||||
}
|
||||
.onErrorResume { t ->
|
||||
Mono.just(CallResult.fail(ctx.id, ctx.nonce, t, ctx))
|
||||
@@ -393,7 +393,11 @@ open class NativeCall(
|
||||
override fun processResult(result: QuorumRpcReader.Result): ByteArray {
|
||||
val bytes = result.value
|
||||
if (bytes.last() == quoteCode) {
|
||||
val suffix = result.resolvers.first().toUByte().toString(16).padStart(2, padChar = '0').toByteArray()
|
||||
val suffix = result.resolvers
|
||||
.map { it.nodeId() }
|
||||
.first()
|
||||
.toUByte()
|
||||
.toString(16).padStart(2, padChar = '0').toByteArray()
|
||||
bytes[bytes.lastIndex] = suffix.first()
|
||||
return bytes + suffix.last() + quoteCode
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user