mirror of
https://github.com/corda/corda.git
synced 2025-06-21 00:23:09 +00:00
Updated DB schemas from using string'ified key to use hash of key.
This commit is contained in:
@ -1,11 +1,11 @@
|
||||
package net.corda.core.schemas
|
||||
|
||||
import net.corda.core.crypto.SecureHash
|
||||
import net.corda.core.identity.PartyAndCertificate
|
||||
import net.corda.core.node.NodeInfo
|
||||
import net.corda.core.serialization.deserialize
|
||||
import net.corda.core.serialization.serialize
|
||||
import net.corda.core.utilities.NetworkHostAndPort
|
||||
import net.corda.core.utilities.toBase58String
|
||||
import java.io.Serializable
|
||||
import javax.persistence.*
|
||||
|
||||
@ -85,8 +85,8 @@ object NodeInfoSchemaV1 : MappedSchema(
|
||||
@Table(name = "node_info_party_cert")
|
||||
data class DBPartyAndCertificate(
|
||||
@Id
|
||||
@Column(name = "owning_key", length = 65535, nullable = false)
|
||||
val owningKey: String,
|
||||
@Column(name = "owning_key_hash")
|
||||
val owningKeyHash: String,
|
||||
|
||||
//@Id // TODO Do we assume that names are unique? Note: We can't have it as Id, because our toString on X500 is inconsistent.
|
||||
@Column(name = "party_name", nullable = false)
|
||||
@ -102,10 +102,10 @@ object NodeInfoSchemaV1 : MappedSchema(
|
||||
private val persistentNodeInfos: Set<PersistentNodeInfo> = emptySet()
|
||||
) {
|
||||
constructor(partyAndCert: PartyAndCertificate, isMain: Boolean = false)
|
||||
: this(partyAndCert.party.owningKey.toBase58String(), partyAndCert.party.name.toString(), partyAndCert.serialize().bytes, isMain)
|
||||
: this(SecureHash.sha256(partyAndCert.owningKey.encoded).toString(), partyAndCert.party.name.toString(), partyAndCert.serialize().bytes, isMain)
|
||||
|
||||
fun toLegalIdentityAndCert(): PartyAndCertificate {
|
||||
return partyCertBinary.deserialize<PartyAndCertificate>()
|
||||
return partyCertBinary.deserialize()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user